android

Is it possible to make a button on an AlertDialog that doesn't automatically close the dialog?

I have a simple list view with some check boxes in an alert dialog. I need to option to add a select all/none but you can't bring up the menu in an alert dialog, and I want to do this function from a button. From what I've seen any kind of button (positive, neutral, and negative) all close the dialog regardless. So, is this possible? ...

How can I get latency info from Android's AudioTrack class?

I've noticed that the C++ classes underlying the AudioTrack and AudioRecord APIs in Android both have a latency() method that is not exposed via JNI. As far as I can see, the latency() method in AudioRecord still does not take into account the hardware latency (they have a TODO comment for that), but the latency() method in AudioTrack do...

How can I tell if a closed path contains a given point?

In Android, I have a Path object which I happen to know defines a closed path, and I need to figure out if a given point is contained within the path. What I was hoping for was something along the lines of path.contains(int x, int y) but that doesn't seem to exist. The specific reason I'm looking for this is because I have a collecti...

Find if GPS provider failed to get location in android

How can I find out that the GPS provider has failed to get location in android? Thanks ...

Posting a JSON array to webservice in Android

I am having some problems with what should be a rather simple task. I simply need a JSON array with a single JSON object within it to be posted to my webservice. The entire URL request needs to be formatted like this: http://www.myserver.com/myservice.php?location_data=[{"key1":"val1","key2":"val2"....}] I cannot for the life of me fig...

Resizing and rotating an image in Android

I'm trying to rotate and resize an image in Android. The code I have is as follows, (taken from this tutorial): UPDATE: More code added below for more constructive feedback public class AnimatedSprite { private Bitmap bitmap; private double posX, posY; private double velocityX, velocityY; private i...

android : listview customization

hi, it is possible to have single listview with 2 or more columns ,which is operatable with paging property (i.e. at a time listview will show only 4 items in single column and on press of right arrow it will show next 4 items ).. can u please tell me he procedure to implement it or any idea. Thanks puneet ...

Declaring Intent Filter in android

Hi, I have problem in declaring the intents on my app. I have a form with text fields and spinner. I have added a button which onClick must display Datepicker. I have declared the DatePicker as a new class and added to intent onCLick. date.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { ...

ellipsize problem with MaxLenght in TextView?

friends, i am using following TextView <TextView android:id="@+id/textLine" android:layout_height="wrap_content" android:textSize="18px" android:singleLine="true" android:maxLength="27" android:ellipsize="end" android:textColor="#ffffff" android:layout_width="wrap_content" /> when i use MaxLenght ellipsize does n...

How to serialize a Bundle?

I'd like to serialize a Bundle object, but can't seem to find a simple way of doing it. Using Parcel doesn't seem like an option, since I want to store the serialized data to file. Any ideas on ways to do this? The reason I want this is to save and restore the state of my activity, also when it's killed by the user. I already create a ...

Adding a external jar reference in Android.mk

I want to add a external third party jar file in the inbuilt android app. I've added the LOCAL_CLASSPATH variable in Android.mk due to which the compilation goes fine. But during runtime, it is not able to find the class definiation which is in the JAR. Which is the variable I need to set to add the third party JARs in the .dex/.apk ? ...

JSON array deserialization is crashing the Dalvik VM

I have some code grabbing a JSON array from my server and initially storing it as a string. This all works fine until I try and deserialize it using google's gson fromJson method. LogCat spits out the error: 04-08 17:46:35.163: ERROR/dalvikvm(401): Can't shrink stack: curFrame is in reserved area (0x41049000 0x410491c4) My code that ca...

How to handle data output in an Observer?

I have an Observable and an Observer. The observable does download some stuff in a background thread and calls notifyObservers to let the observers read the status. At some point in public void update the observer tries to updates the GUI ((TextView)findViewById('R.id.foo')).setText("bar"); but it seems like the observable thread ca...

Quartz 2D or OpenGL ES? Pros and cons in the long term, possibility of migration to other platforms.

Hi all! I'm having a hard time deciding whether to go with Quartz2D or OpenGL for an iPad game. It will be 2D mostly, but effect-intense (simultaneous lighting effects for 10-30 objects, 10-20 simultaneous animations on the screen). So far, assuming i'm equally dumb in both technologies and have to learn them from the ground, i came to ...

Hashset Keypad android Suduko

Ive a hashset, which produces the possible number for each cell in the grid public void PotentialMoves(int i, int j,int []puzzle) { Set<Integer> all = new HashSet<Integer>(); for (int n= 0; n< 9; n++) all.add(new Integer(n+1)); if (puzzle[j * 9 + i] != 0)return; Set<Integer> used = new HashSet<Integer>(); ...

how to maintain a Home Button Presistent state of an app in Android?

hi all, i am working on my App. in between i pressed the Home button on the device. my app will go to the background tasks. After that i long press the home button it will show my app as a persistent state. i.e where and what i had done in my app. But i click my app in the directory window it restarts my app. i want to do if my app is i...

Android emulator is based on QEMU. Can I use KVM with it?

My laptop supports hardware virtualization (AMD SVM) and I know that: QEMU can make use of hardware virtualization through KVM; The Android emulator is very much based on QEMU Natural question follows: can I combine the two (Android+KVM) to get improved performance in the emulator? ...

Android: OutOfMemoryError while uploading video - how best to chunk?

Hi all, I have the same problem as described here, but I will supply a few more details. While trying to upload a video in Android, I'm reading it into memory, and if the video is large I get an OutOfMemoryError. Here's my code: // get bytestream to upload videoByteArray = getBytesFromFile(cR, fileUriString); public static byte[] ge...

Android NDK jni problem

I have started teaching myself about the Android NDK and I have followed this example here - http://marakana.com/forums/android/android_examples/49.html I have followed the steps perfectly but when I run the application I get the following error: Trying to load lib /data/data/com.cnetworks.ndk/lib/libndk_demo.so 0x435c2d20 Added shared...

Internet connection in android emulator always displays connected state

hi I tried in many ways to check Internet connection in my android emulator ConnectivityManager conMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info= conMgr.getActiveNetworkInfo(); if(info != null || info.isConnected()) { Log.v("NetworkInfo","Connected State...