android

How to get "calling" Activity instance from called Activity?

I have a Contact Activity which is derived from ListActivity, which displays list of contacts, and on click of item, a new Activity Message Activity derived from ListActivity is initialized. Now I know, I can pack some information in Bundle and pass it before creating activity, but is there a way I can get instance of "ContactActivity...

Android-ndk: difference between static and shared library

Hi I'm new to Android ndk and i didn't understand yet which are the differences between static and shared library. Could you explain me what these differences are? When developing a library how could i choose one of them? Thanks a lot ...

Calling BroadcastReciever from activity

Hello , I have a broadcast class that blocks the incoming call. I want to call that broadcast receiver from the activity . Can any one help me fix this. I appreciate your help. 1. Class A extends activity will call Class B that extends BroadcastReceiver, now I want to block calls , only based on certain requirements, which are checked i...

Can't grab progress on http POST file upload (Android)

I am developing an Android app which enables the user to upload a file to services like Twitpic and others. The POST upload is done without any external libraries and works just fine. My only problem is, that I can't grab any progress because all the uploading is done when I receive the response, not while writing the bytes into the outp...

WebView Bug - Not Sizing correctly

It appears that my WebView is ALWAYS FULL screen and doesn't respect the layout . Also, Activity menus are not the ones I set but the browsers. If the URL is www.google.com in mobile mode or stackoverflow.com it appears to work ok !?! But once you click on Classic mode or any other web site in mobile/regular it takes up the whole s...

android force close: ClassNotFoundException for Activity class

Hi! When I start my (soon-to-be) android game (from eclipse) it opens, but immediately force-closes. Logcat says: 07-09 17:12:35.709: ERROR/AndroidRuntime(3866): Uncaught handler: thread main exiting due to uncaught exception 07-09 17:12:35.719: ERROR/AndroidRuntime(3866): java.lang.RuntimeException: Unable to instantiate activity Com...

Parse simple JSON

Hi, I have a trouble to parse this piece of JSON { "00408C88A2E6": { "id": "00408C88A2E6", "name": "pippo"}, "00408C91188B": { "id": "00408C91188B", "name": "pluto" }, "00408C944B99": { "id": "00408C944B99", "name": "minni" }, "00408C944BA0": { "id": "00408C944BA0", "nam...

android layoutopt: This tag and its children can be replaced by one <TextView/> and a compound drawable

When I run layoutopt on a specific xml file, I get this: This tag and its children can be replaced by one <TextView/> and a compound drawable What change should be done for the following xml code: <LinearLayout android:id="@+id/name_layout" android:layout_width="fill_parent" android:layout_height="wr...

Is there a way to detect whether Sense UI is running on a device?

Is there any way in Android to determine whether a device is running Sense UI? I'm working on an app that is working fine with vanilla Android, but Sense UI is messing with layouts and sizes. I'd like to be able to see whether the device is running Sense UI and so I can take appropriate action. ...

Which class is called first Activity ,BroadcastReceiver or Service?

I have 3 classes in my App. Class A extends Activity class B extends BroadcastReceiver Class C extends Service. When I run the App. which one of this will be called first, I know android doesn't have a entry point. I am blocking the incoming call in class B , and I am calling the service from activity > this service will call Broadca...

how to send key events to a headless emulator in an instrumentation test?

We are currently working on an instrumentation test suite which runs on our build server, but while the tests pass on a dev machine using a normal Android emulator, the builds fail on the build server since there we only run a headless emulator with the -no-window flag. The failure occurs when trying to invoke the InstrumentationTestCas...

Android - Debug slow running code

Hi, Is there a good way (proper way, or effective way) to debug slow running code? I have a thread which runs multiple loops and then recurses and my code is running very slow. Is there a good way to debug different loops or sections of code to find out which is running slowest? If the debugger already does this, can someone please e...

Android Emulator Force closes when loading Custom Layout

Hello all, i created a custom layout where i have a couple of LinearLayout in a ScrollView. Problem is when i set my SetContentView to my custom Layout (when the application starts), the emulator gives an error and force closes! i don't know why. i have tried with another custom layout or set it to main and it seems to work fine. any i...

Android Debugging ???

What is the best way to debug an android application? Every once in a while the application crashes, an it says application has stopped unexpectedly, it never says why it crashes, or where in my code, what's the bet way to find the reason for crashes, and exceptions? ...

Can't read/write to sdcard in Android

Can any one help in that problem when i try that code File routesRoot = Environment.getExternalStorageDirectory(); if (!routesRoot.canWrite()) System.out.println("can't write root"); if (!routesRoot.canRead()) System.out.println("can't read root"); when run program both can't wr...

Streaming image from url continuously

Im displaying image from URL. I implemented using a thread to retrieve data from URL for every 10 secs. Some times my application showing a message Application Not Responding dialog. When i google for the issue i found that we can use AysncTask for loading image. Using Async Task im able to get the image, bt what i need is retrieve d...

BroadcastReceiver active all the time

I have a app that has call blocking feature in it and that work is done by class BroadcastReceiver. When I install this app, the call is blocked always no matter what. How to get rid of this? I want this app to be active only when App is up and running . If I stop the service the App should not block the call. Thank you any help will be ...

Internal error receiving info using bluetooth on an android phone

What is the possible cause of receiving this line on the application logs when trying to receive information via Bluetooth from a device paired to my android phone? Obex Server Session - java.io.IOException: Software caused connection abort This exception occurs internally and it is not propagated to my code. Any ideas? ...

ListView not checking items on Android 1.5

Hi, I'm developing an app for Android in Eclipse. Currently I target API level 3, but I was mistakenly testing on an Android 1.6 emulator (API level 4). On 1.6 it worked fine, but on 1.5 my ListView with CHOICE_MODE_SINGLE does not select items when they are clicked on. Here's my listview XML: <ListView android:layout_height="wr...

Generate Map<String,String> from POJO

I have a POJO, and a (currently not-yet-built) class that will return Lists of it. I'd like to automatically generate the code necessary for the POJO to be accessed as a Map. Is this a good idea, is it possible to do automatically, and do I need to do this manually for every POJO I want to treat this way? Thanks, Andy ...