Search Results

Search found 11792 results on 472 pages for 'android webview'.

Page 63/472 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • Android Bitmap : collision Detecting [on hold]

    - by user2505374
    I am writing an Android game right now and I would need some help in the collision of the wall on screen. When I drag the ball in the top and right it able to collide in wall but when I drag it faster it was able to overlap in the wall. public boolean onTouchEvent(MotionEvent event) { int x = (int) event.getX(); int y = (int) event.getY(); switch (event.getAction()) { // if the player moves case MotionEvent.ACTION_MOVE: { if (playerTouchRect.contains(x, y)) { boolean left = false; boolean right = false; boolean up = false; boolean down = false; boolean canMove = false; boolean foundFinish = false; if (x != pLastXPos) { if (x < pLastXPos) { left = true; } else { right = true; } pLastXPos = x; } if (y != pLastYPos) { if (y < pLastYPos) { up = true; } else { down = true; } pLastYPos = y; } plCellRect = getRectFromPos(x, y); newplRect.set(playerRect); newplRect.left = x - (int) (playerRect.width() / 2); newplRect.right = x + (int) (playerRect.width() / 2); newplRect.top = y - (int) (playerRect.height() / 2); newplRect.bottom = y + (int) (playerRect.height() / 2); int currentRow = 0; int currentCol = 0; currentRow = getRowFromYPos(newplRect.top); currentCol = getColFromXPos(newplRect.right); if(!canMove){ canMove = mapManager.getCurrentTile().pMaze[currentRow][currentCol] == Cell.wall; canMove =true; } finishTest = mapManager.getCurrentTile().pMaze[currentRow][currentCol]; foundA = finishTest == Cell.valueOf(letterNotGet + ""); canMove = mapManager.getCurrentTile().pMaze[currentRow][currentCol] != Cell.wall; canMove = (finishTest == Cell.floor || finishTest == Cell.pl) && canMove; if (canMove) { invalidate(); setTitle(); } if (foundA) { mapManager.getCurrentTile().pMaze[currentRow][currentCol] = Cell.floor; // finishTest letterGotten.add(letterNotGet); playCurrentLetter(); /*sounds.play(sExplosion, 1.0f, 1.0f, 0, 0, 1.5f);*/ foundS = letterNotGet == 's'; letterNotGet++; }if(foundS){ AlertDialog.Builder builder = new AlertDialog.Builder(mainActivity); builder.setTitle(mainActivity.getText(R.string.finished_title)); LayoutInflater inflater = mainActivity.getLayoutInflater(); View view = inflater.inflate(R.layout.finish, null); builder.setView(view); View closeButton =view.findViewById(R.id.closeGame); closeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View clicked) { if(clicked.getId() == R.id.closeGame) { mainActivity.finish(); } } }); AlertDialog finishDialog = builder.create(); finishDialog.show(); } else { Log.d(TAG, "INFO: updated player position"); playerRect.set(newplRect); setTouchZone(); updatePlayerCell(); } } // end of (CASE) if playerTouch break; } // end of (SWITCH) Case motion }//end of Switch return true; }//end of TouchEvent private void finish() { // TODO Auto-generated method stub } public int getColFromXPos(int xPos) { val = xPos / (pvWidth / mapManager.getCurrentTile().pCols); if (val == mapManager.getCurrentTile().pCols) { val = mapManager.getCurrentTile().pCols - 1; } return val; } /** * Given a y pixel position, return the row of the cell it is in This is * used when determining the type of adjacent Cells. * * @param yPos * y position in pixels * @return The cell this position is in */ public int getRowFromYPos(int yPos) { val = yPos / (pvHeight / mapManager.getCurrentTile().pRows); if (val == mapManager.getCurrentTile().pRows) { val = mapManager.getCurrentTile().pRows - 1; } return val; } /** * When preserving the position we need to know which cell the player is in, * so calculate it from the centre on its Rect */ public void updatePlayerCell() { plCell.x = (playerRect.left + (playerRect.width() / 2)) / (pvWidth / mapManager.getCurrentTile().pCols); plCell.y = (playerRect.top + (playerRect.height() / 2)) / (pvHeight / mapManager.getCurrentTile().pRows); if (mapManager.getCurrentTile().pMaze[plCell.y][plCell.x] == Cell.floor) { for (int row = 0; row < mapManager.getCurrentTile().pRows; row++) { for (int col = 0; col < mapManager.getCurrentTile().pCols; col++) { if (mapManager.getCurrentTile().pMaze[row][col] == Cell.pl) { mapManager.getCurrentTile().pMaze[row][col] = Cell.floor; break; } } } mapManager.getCurrentTile().pMaze[plCell.y][plCell.x] = Cell.pl; } } public Rect getRectFromPos(int x, int y) { calcCell.left = ((x / cellWidth) + 0) * cellWidth; calcCell.right = calcCell.left + cellWidth; calcCell.top = ((y / cellHeight) + 0) * cellHeight; calcCell.bottom = calcCell.top + cellHeight; Log.d(TAG, "Rect: " + calcCell + " Player: " + playerRect); return calcCell; } public void setPlayerRect(Rect newplRect) { playerRect.set(newplRect); } private void setTouchZone() { playerTouchRect.set( playerRect.left - playerRect.width() / TOUCH_ZONE, playerRect.top - playerRect.height() / TOUCH_ZONE, playerRect.right + playerRect.width() / TOUCH_ZONE, playerRect.bottom + playerRect.height() / TOUCH_ZONE); } public Rect getPlayerRect() { return playerRect; } public Point getPlayerCell() { return plCell; } public void setPlayerCell(Point cell) { plCell = cell; }

    Read the article

  • Cannot connect to Open WiFi hotspot created by Android

    - by Bibhas
    I'm trying to share my 3G data connection via WiFi hotspot. I have an open Hotspot running on my phone(Xperia Neo V - MT11i - Android 2.3.4). But I cannot connect to it from my Ubuntu system. Here is the syslog while I try to connect to it - NetworkManager[1077]: <info> Activation (wlan0) starting connection 'TheNeo' NetworkManager[1077]: <info> (wlan0): device state change: disconnected -> prepare (reason 'none') [30 40 0] NetworkManager[1077]: <info> Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled... NetworkManager[1077]: <info> Activation (wlan0) Stage 1 of 5 (Device Prepare) started... NetworkManager[1077]: <info> Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled... NetworkManager[1077]: <info> Activation (wlan0) Stage 1 of 5 (Device Prepare) complete. NetworkManager[1077]: <info> Activation (wlan0) Stage 2 of 5 (Device Configure) starting... NetworkManager[1077]: <info> (wlan0): device state change: prepare -> config (reason 'none') [40 50 0] NetworkManager[1077]: <info> Activation (wlan0/wireless): connection 'TheNeo' requires no security. No secrets needed. NetworkManager[1077]: <info> Config: added 'ssid' value 'TheNeo' NetworkManager[1077]: <info> Config: added 'scan_ssid' value '1' NetworkManager[1077]: <info> Config: added 'key_mgmt' value 'NONE' NetworkManager[1077]: <info> Activation (wlan0) Stage 2 of 5 (Device Configure) complete. NetworkManager[1077]: <info> Config: set interface ap_scan to 1 NetworkManager[1077]: <info> (wlan0): supplicant interface state: inactive -> scanning wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) NetworkManager[1077]: <info> (wlan0): supplicant interface state: scanning -> authenticating kernel: [17498.113553] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17498.310138] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17498.510069] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17498.710083] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) kernel: [17504.779927] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17504.976420] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17505.176379] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17505.376314] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) kernel: [17511.478385] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17511.674738] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17511.874655] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17512.074659] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) kernel: [17518.152643] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17518.349064] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17518.549051] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17518.748999] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) kernel: [17524.858896] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17525.055404] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17525.255387] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17525.455254] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) kernel: [17531.589176] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17531.785747] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17531.985724] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17532.185610] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) kernel: [17538.329257] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17538.528003] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17538.728024] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17538.927922] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) kernel: [17545.022036] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17545.218339] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17545.418319] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17545.618206] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out wpa_supplicant[29352]: Trying to authenticate with 5c:b5:24:2f:d1:2f (SSID='TheNeo' freq=2462 MHz) kernel: [17551.724177] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 1/3) kernel: [17551.920685] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 2/3) kernel: [17552.120597] wlan0: direct probe to 5c:b5:24:2f:d1:2f (try 3/3) kernel: [17552.320526] wlan0: direct probe to 5c:b5:24:2f:d1:2f timed out NetworkManager[1077]: <warn> Activation (wlan0/wireless): association took too long, failing activation. NetworkManager[1077]: <info> (wlan0): device state change: config -> failed (reason 'supplicant-timeout') [50 120 11] NetworkManager[1077]: <warn> Activation (wlan0) failed for access point (TheNeo) NetworkManager[1077]: <warn> Activation (wlan0) failed. NetworkManager[1077]: <info> (wlan0): device state change: failed -> disconnected (reason 'none') [120 30 0] NetworkManager[1077]: <info> (wlan0): deactivating device (reason 'none') [0] NetworkManager[1077]: <info> (wlan0): supplicant interface state: authenticating -> disconnected NetworkManager[1077]: <warn> Couldn't disconnect supplicant interface: This interface is not connected. Why is direct probe to 5c:b5:24:2f:d1:2f timed out? Any idea?

    Read the article

  • Error using eclipse for Android - No resource found that matches the given name.

    - by Kenny
    Common problem I'm sure, but I can't figure it out. In my AndroidManifest.xml and main.xml I'm getting the no resource found that matches the given name. I've double checked for typos and it used to work, but now I'm popping up with all these errors saying it can't find my strings in my strings.xml. These are the ones I'm getting errors for in my main.xml. <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dip" android:text="@string/instructions" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dip" android:text="@string/level_prompt" /> <Spinner android:id="@+id/spinner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:prompt="@string/level_array" /> These are the ones I'm getting for my androidmanifest.xml. <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloFormStuff" android:label="@string/title"> This is what my strings.xml looks like. <string name="title">Title</string> <string name="app_name">Application name</string> <string name="instructions">Enter instructions here.</string> <string name="level_prompt">Choose an item</string> <string-array name="level_array"> <item>Item One</item> <item>Item Two</item> <item>Item Three</item> <item>Item Four</item> </string-array> Any ideas? Any help would be appreciated!!

    Read the article

  • Why is my Android app camera preview running out of memory on my AVD?

    - by Bryan
    I have yet to try this on an actual device, but expect similar results. Anyway, long story short, whenever I run my app on the emulator, it crashes due to an out of memory exception. My code really is essentially the same as the camera preview API demo from google, which runs perfectly fine. The only file in the app (that I created/use) is as below- package berbst.musicReader; import java.io.IOException; import android.app.Activity; import android.content.Context; import android.hardware.Camera; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; /********************************* * Music Reader v.0001 * Still VERY under construction. * @author Bryan * *********************************/ public class MusicReader extends Activity { private MainScreen main; @Override //Begin activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); main = new MainScreen(this); setContentView(main); } class MainScreen extends SurfaceView implements SurfaceHolder.Callback { SurfaceHolder sHolder; Camera cam; MainScreen(Context context) { super(context); //Set up SurfaceHolder sHolder = getHolder(); sHolder.addCallback(this); sHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } public void surfaceCreated(SurfaceHolder holder) { // Open the camera and start viewing cam = Camera.open(); try { cam.setPreviewDisplay(holder); } catch (IOException exception) { cam.release(); cam = null; } } public void surfaceDestroyed(SurfaceHolder holder) { // Kill all our crap with the surface cam.stopPreview(); cam.release(); cam = null; } public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { // Modify parameters to match size. Camera.Parameters params = cam.getParameters(); params.setPreviewSize(w, h); cam.setParameters(params); cam.startPreview(); } } }

    Read the article

  • Android AlertDialog with rounded corners: rectangle seen below corners

    - by user1455909
    I want a Dialog with rounded corners, but when the Dialog is seen there's a rectangle below it that's seen below the corners, like this: I build the dialog using a custom DialogFragment: public class MyDialogFragment extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); builder.setView(inflater.inflate(R.layout.playdialog, null)); return builder.create(); } } The dialog layout (playdialog) has the following drawable as background: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#AAAAAAAA" /> <stroke android:width="2dp" android:color="#FF000000" /> <corners android:radius="20dp" /> </shape> As I said, I set this drawable as background: android:background="@drawable/dialog_background" I don't want that rectangle to be seen. How can I do it?? In this post the user had the same problem. I tried to use the solution that worked for him but it didn't work for me. I modified my DialogFragment like this: public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); builder.setView(inflater.inflate(R.layout.playdialog, null)); Dialog d = builder.create(); d.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); return d; } The result is exactly the same. How can I remove that rectangle? Thanks!

    Read the article

  • Android "java.lang.noclassdeffounderror" exception

    - by wpbnewbie
    Hello, I have a android webservice client application. I am trying to use the java standard WS library support. I have stripped the application down to the minimum, as shown below, to try and isolate the issue. Below is the applicaiton, package fau.edu.cse; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class ClassMap extends Activity { TextView displayObject; @Override public void onCreate(Bundle savedInstanceState) { // Build Screen Display String String screenString = "Program Started\n\n"; // Set up the display super.onCreate(savedInstanceState); setContentView(R.layout.main); displayObject = (TextView)findViewById(R.id.TextView01); screenString = screenString + "Inflate Disaplay\n\n"; try { // Set up Soap Service TempConvertSoap service = new TempConvert().getTempConvertSoap(); // Successful Soap Object Build screenString = screenString + "SOAP Object Correctly Build\n\n"; // Display Response displayObject.setText(screenString); } catch(Throwable e){ e.printStackTrace(); displayObject.setText(screenString +"Try Error...\n" + e.toString()); } } } The classes tempConvert and tempConvertSoap are in the package fau.edu.cse. I have included the java SE javax libraries in the java build pasth. When the android application tries to create the "service" object I get a "java.lang.noclassdeffounderror" exception. The two classes tempConvertSoap and TempConvet() are generated by wsimport. I am also using several libraries from javax.jws.. and javax.xml.ws.. Of course the application compiles without error and loads correctly. I know the application is running becouse my "try/catch" routine is successfully catching the error and printing it out. Here is what is in the logcat says (notice that it cannot find TempConvert), 06-12 22:58:39.340: WARN/dalvikvm(200): Unable to resolve superclass of Lfau/edu/cse/TempConvert; (53) 06-12 22:58:39.340: WARN/dalvikvm(200): Link of class 'Lfau/edu/cse/TempConvert;' failed 06-12 22:58:39.340: ERROR/dalvikvm(200): Could not find class 'fau.edu.cse.TempConvert', referenced from method fau.edu.cse.ClassMap.onCreate 06-12 22:58:39.340: WARN/dalvikvm(200): VFY: unable to resolve new-instance 21 (Lfau/edu/cse/TempConvert;) in Lfau/edu/cse/ClassMap; 06-12 22:58:39.340: DEBUG/dalvikvm(200): VFY: replacing opcode 0x22 at 0x0027 06-12 22:58:39.340: DEBUG/dalvikvm(200): Making a copy of Lfau/edu/cse/ClassMap;.onCreate code (252 bytes) 06-12 22:58:39.490: DEBUG/dalvikvm(30): GC freed 2 objects / 48 bytes in 273ms 06-12 22:58:39.530: DEBUG/ddm-heap(119): Got feature list request 06-12 22:58:39.620: WARN/Resources(200): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f050000} 06-12 22:58:39.620: WARN/System.err(200): java.lang.NoClassDefFoundError: fau.edu.cse.TempConvert 06-12 22:58:39.830: WARN/System.err(200): at fau.edu.cse.ClassMap.onCreate(ClassMap.java:26) 06-12 22:58:39.830: WARN/System.err(200): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 06-12 22:58:39.830: WARN/System.err(200): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 06-12 22:58:39.830: WARN/System.err(200): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 06-12 22:58:39.830: WARN/System.err(200): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 06-12 22:58:39.880: WARN/System.err(200): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 06-12 22:58:39.880: WARN/System.err(200): at android.os.Handler.dispatchMessage(Handler.java:99) 06-12 22:58:39.880: WARN/System.err(200): at android.os.Looper.loop(Looper.java:123) 06-12 22:58:39.880: WARN/System.err(200): at android.app.ActivityThread.main(ActivityThread.java:4363) 06-12 22:58:39.880: WARN/System.err(200): at java.lang.reflect.Method.invokeNative(Native Method) 06-12 22:58:39.880: WARN/System.err(200): at java.lang.reflect.Method.invoke(Method.java:521) 06-12 22:58:39.880: WARN/System.err(200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 06-12 22:58:39.880: WARN/System.err(200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 06-12 22:58:39.880: WARN/System.err(200): at dalvik.system.NativeStart.main(Native Method) ...bla...bla...bla It would be great if someone just had an answer, however I am looking at debug strategies. I have taken this same application and created a standard java client application and it works fine -- of course with all of the android stuff taken out. What would be a good debug strategy? What methods and techniques would you recommend I try and isolate the problem? I am thinking that there is some sort of Dalvik VM incompatibility that is causing the TempConvert class not to load. TempConvert is an interface class that references a lot of very tricky webservice attributes. Any help with debug strategies would be gladly appreciated. Thanks for the help, Steve

    Read the article

  • Android seekbar widget: no vertical orientation?

    - by Silvio Donnini
    I can't believe there is no way to change the orientation of the SeekBar widget. I've been perusing this widget's properties and I can't find anything that allows me to change its orientation to vertical. So, am I missing something obvious? Do I have to write my own implementation of a seekbar to have its thumb slide up/down instead of left/right?

    Read the article

  • Android: List View Selected item -1

    - by Josemalive
    Hi, Im getting a -1 value when i try to get the selected item position on my listview that is already populated. list.setOnItemClickListener ( new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView adapterView, View view,int arg2, long arg3) { int selectedPosition = adapterView.getSelectedItemPosition(); ShowAlert(String.valueOf(selectedPosition)); } } ); To fill my list view i use the following code: SimpleAdapter mSchedule = new SimpleAdapter( this, mylist, R.layout.listviewtest, new String[] {"test1", "test2", "test3"}, new int[] {R.id.TextView_websitename, R.id.TextView_keywords, R.id.TextView_backlink}); Any idea? Thanks in advance. Best Regards. Jose.

    Read the article

  • Unable to mute the microphone in Android

    - by J Andy
    Hi, I'm working on an app that uses AudioRecord class to get input data from the phone mic. For some reason I'm unable to mute the mic. I have tried with different AudioSources (DEFAULT, MIC and VOICE_UPLINK) when creating the AudioRecord object, but there's no difference in the muting behaviour. The muting itself, I'm trying to achieve with AudioManager#setMicrophoneMute() method. Any ideas? Thanks.

    Read the article

  • Android: Using linear gradient as background looks banded

    - by user329692
    Hi All! I'm trying to apply a linear gradient to my ListView. This is the content of my drawable xml: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#3A3C39" android:endColor="#181818" android:angle="270" /> <corners android:radius="0dp" /> </shape> So I apply it to my ListView with: android:background="@drawable/shape_background_grey" It works but it looks very "banded" on emulator and on a real device too. Is there any way to reduce this "behaviour"?

    Read the article

  • Android: Programmatically move between images in Gallery widget

    - by bdls
    I'd like to programmatically move between images in the Gallery widget, with animation. I can change the currently displaying image using the setSelection(int position) method, however that does not animate. Then there's setSelection(int position, bool animate) but the extra boolean on the end there doesn't appear to do anything. In the source of Gallery it appears that it can handle DPAD key-presses, so a work-around I thought of was to fake the key-presses. Eg. dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_LEFT)) However I can't get this working for some reason. Anyone tried this? I notice three of the widget's methods I'd love to use moveNext(), movePrevious() and scrollToChild() are all private and unusable. Does anyone know how I might be able to do this?

    Read the article

  • Android: How can I validate EditText input?

    - by Stefan
    I need to do form validation on a series of EditTexts. I'm using OnFocusChangeListeners to trigger the validation, but this doesn't behave as desired for the final EditText. If I click on the "Done" button while typing into the final EditText then the InputMethod is disconnected, but technically focus is never lost on the EditText (and so validation never occurs). What's the best solution? Should I be monitoring when the InputMethod unbinds from each EditText rather than when focus changes? If so, how?

    Read the article

  • Android - ListView click HOWTO?

    - by teepusink
    Hi, How do I listen to click event on a ListView? This is what I have now ListView list = (ListView)findViewById(R.id.ListView01); ... list.setAdapter(adapter); When I do the following list.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parentView, View childView, int position, long id) { setDetail(position); } public void onNothingSelected(AdapterView parentView) { } }); That doesn't seem to do anything on click. And all those code live within a class that extends Activity. Thanks, Tee

    Read the article

  • get contact info from android contact picker

    - by ng93
    hi im trying to call the contact picker, get the persons name, phone and e-mail into strings and send them to another activity using an intent. So far this works Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, 1); @Override public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { Uri contactData = data.getData(); Cursor c = managedQuery(contactData, null, null, null, null); if (c.moveToFirst()) { String name = c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME)); Intent intent = new Intent(CurrentActivity.this, NewActivity.class); intent.putExtra("name", name); startActivityForResult(intent, 0); } } } but if i add in: String number = c.getString(c.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.NUMBER)); it force closes maybe theres another way to get their number? thanks for help, ng93

    Read the article

  • Button click does not start Service in Android App Widget

    - by Feanor
    I'm having trouble starting a Service to update an AppWidget that I'm creating as an exercise. I'm trying to get the latitude and longitude of spoofed location data from DDMS to display in the widget. The widget uses a service to update the TextView, which may be slightly overkill, but I wanted to follow the template that seems to be common in AppWidgets that do more work (like the Forecast widget or the Wiktionary widget). Right now, I'm not getting any error messages or strange behavior; nothing at all happens when the button is pressed. I'm a bit mystified as to what might be wrong. Could anyone out there point me in the right direction? Additionally, if my logic for location is faulty, I'd love recommendations on that too. I've looked at several blogs, the Google examples, and the documentation, but I feel a little fuzzy on how it works. Here is the current state of the widget: public class Widget extends AppWidgetProvider { static final String TAG = "Widget"; /** * {@inheritDoc} */ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // Create an intent to launch the service Intent serviceIntent = new Intent(context, UpdateService.class); // PendingIntent is required for the onClickPendingIntent that actually // starts the service from a button click PendingIntent pendingServiceIntent = PendingIntent.getService(context, 0, serviceIntent, 0); // Get the layout for the App Widget and attach a click listener to the // button RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.main); views.setOnClickPendingIntent(R.id.address_button, pendingServiceIntent); super.onUpdate(context, appWidgetManager, appWidgetIds); } // To prevent any ANR timeouts, we perform the update in a service; // really should have its own thread too public static class UpdateService extends Service { static final String TAG = "UpdateService"; private LocationManager locationManager; private Location currentLocation; private double latitude; private double longitude; public void onStart(Intent intent, int startId) { // Get a LocationManager from the system services locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Register for updates from spoofed GPS locationManager.requestLocationUpdates("gps", 30000L, 0.0f, new LocationListener() { @Override public void onLocationChanged(Location location) { currentLocation = location; } @Override public void onProviderDisabled(String provider) {} @Override public void onProviderEnabled(String provider) {} @Override public void onStatusChanged(String provider, int status, Bundle extras) {} }); // Get the last known location from GPS currentLocation = locationManager.getLastKnownLocation("gps"); // Build the widget update RemoteViews updateViews = buildUpdate(this); // Push update for this widget to the home screen ComponentName thisWidget = new ComponentName(this, Widget.class); // AppWidgetManager updates AppWidget state; gets information about // installed AppWidget providers and other AppWidget related state AppWidgetManager manager = AppWidgetManager.getInstance(this); // Updates the views based on the RemoteView returned from the // buildUpdate method (stored in updateViews) manager.updateAppWidget(thisWidget, updateViews); } public RemoteViews buildUpdate(Context context) { latitude = currentLocation.getLatitude(); longitude = currentLocation.getLongitude(); RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.main); updateViews.setTextViewText(R.id.latitude_text, "" + latitude); updateViews.setTextViewText(R.id.longitude_text, "" + longitude); return updateViews; } @Override public IBinder onBind(Intent intent) { // We don't need to bind to this service return null; } } }

    Read the article

  • Android Update Layout Content

    - by GuyNoir
    I'm looking for a way to update a layout's content with a new view. Is there any way to easily do this. It would be similar to how tabs work, but I don't want to have to get into extending the current tab structure if I don't have to. The final result would be a few buttons that would switch the content in a specific linearlayout for each button. Any help?

    Read the article

  • Android - Launch Intent within ExpandableListView

    - by Ryan
    Hello, I'm trying to figure out if it is possible to launch an intent within an ExpandableListView. Basically one of the "Groups" is Phone Number and it's child is the number. I want the user to be able to click it and have it automatically call that number. Is this possible? How? Here is my code to populate the ExpandableListView using a Map called "data". ExpandableListView myList = (ExpandableListView) findViewById(R.id.myList); //ExpandableListAdapter adapter = new MyExpandableListAdapter(data); List<Map<String, String>> groupData = new ArrayList<Map<String, String>>(); List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>(); Iterator it = data.entrySet().iterator(); while (it.hasNext()) { //Get the key name and value for it Map.Entry pair = (Map.Entry)it.next(); String keyName = (String) pair.getKey(); String value = pair.getValue().toString(); //Add the parents -- aka main categories Map<String, String> curGroupMap = new HashMap<String, String>(); groupData.add(curGroupMap); curGroupMap.put("NAME", keyName); //Add the child data List<Map<String, String>> children = new ArrayList<Map<String, String>>(); Map<String, String> curChildMap = new HashMap<String, String>(); children.add(curChildMap); curChildMap.put("NAME", value); childData.add(children); } // Set up our adapter mAdapter = new SimpleExpandableListAdapter( mContext, groupData, R.layout.exp_list_parent, new String[] { "NAME", "IS_EVEN" }, new int[] { R.id.rowText1, R.id.rowText2 }, childData, R.layout.exp_list_child, new String[] { "NAME", "IS_EVEN" }, new int[] { R.id.rowText3, R.id.rowText4} ); myList.setAdapter(mAdapter);

    Read the article

  • After making a call programatically, my android app crashes

    - by Casidiablo
    Hello! The title explains all... I have this snippet of code in my application: String url = createTelUrl("3112007315"); Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(url)); context.startActivity(intent); It does make a call, but once the call ends, my application crashes. I'd like to return to my application once the call has finished, but I read this post and it seems not to be possible. So... is there anyway to at least pause my application and resume it once the call has finished? Thank you so much for reading.

    Read the article

  • android: How to play YouTube video on emulator

    - by Kaillash
    Could someone help me in 1. is this possible to play video from YouTube on emulator using YouTube video link (like:http://www.youtube.com/watch?v=T1Wgp3mLa_E) ? If not, then why? 2.If yes then how ? I tried to play YouTube video using VideoView but got "Command PLAYER_INIT completed with an error or info PVMFErrCorrupt" message through logcat command.

    Read the article

  • Android 2.2 and "Bad address family" on Socket Connect

    - by Josh
    I have a fairly simple game that works perfectly on every version now up through 2.1, but with the new 2.2 (Froyo) release I am unable to create a socket. I am using the mina package for nio, and get this exception: W/System.err( 263): java.net.SocketException: Bad address family W/System.err( 263): at org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocketImpl(Native Method) W/System.err( 263): at org.apache.harmony.luni.platform.OSNetworkSystem.connect(OSNetworkSystem.java:115) W/System.err( 263): at org.apache.harmony.nio.internal.SocketChannelImpl.connect(SocketChannelImpl.java:272) W/System.err( 263): at org.apache.harmony.nio.internal.PipeImpl$SinkChannelImpl.finishConnect(PipeImpl.java:164) W/System.err( 263): at org.apache.harmony.nio.internal.PipeImpl.(PipeImpl.java:48) W/System.err( 263): at org.apache.harmony.nio.internal.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:51) W/System.err( 263): at org.apache.harmony.nio.internal.SelectorImpl.(SelectorImpl.java:141) W/System.err( 263): at org.apache.harmony.nio.internal.SelectorProviderImpl.openSelector(SelectorProviderImpl.java:58) W/System.err( 263): at java.nio.channels.Selector.open(Selector.java:48) W/System.err( 263): at org.apache.mina.transport.socket.nio.SocketConnector.startupWorker(SocketConnector.java:248) W/System.err( 263): at org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:210) W/System.err( 263): at org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137) W/System.err( 263): at org.apache.mina.common.support.BaseIoConnector.connect(BaseIoConnector.java:40) Later in the log, usually immediately following I get this: W/System.err( 263): java.lang.NullPointerException W/System.err( 263): at org.apache.harmony.nio.internal.SelectorImpl.wakeup(SelectorImpl.java:418) W/System.err( 263): at org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:222) W/System.err( 263): at org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137) W/System.err( 263): at org.apache.mina.common.support.BaseIoConnector.connect(BaseIoConnector.java:40) I have done all the googling and looking around I can think of and found nothing. The closest I have come seems to be an old JDK bug with ipv6 support on XP and Vista machines (I'm running Vista). Recommendations included disabling ipv6 (that did not work) and disabling ipv4 and leaving ipv6 (will not work for me as my router and ISP don't support it and so could not test anyway). Any thoughts, suggestions, things I have not tried? Thanks, Josh

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >