getApplicationContext returns null in test case (unless you sleep first)

by Dianne Hackborn » Thu, 05 Mar 2009 03:58:08 GMT


Sponsored Links
 You are calling this while the app is running, and it hasn't finished
initializing.

Generally you should be very careful about directly touching app objects
like this from tests, since the test is running in a separate thread.  There
are APIs to allow you to run code on the main thread to access its objects.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Releasing a Demo App from Paid App. Need to fork code? How do accomplish?

We have a paid app in the market place, we would like to release a
demo of the paid app. I was hoping we could just recompile w/ the same
package name, but apparently that does not work.

I have tried manually changing package name etc, but it is a chore,
and it seems that several things that automatically happen in eclipse
cause more harm than good when renaming the package name.

Which brings me to my next question. If having a new package name is
the only way to accomplish this. Is there an easy way to fork the paid
app, where keeping the changes synchronized is easier? Some kind of
Source Control?

Thanks.
--~--~---------~--~----~------------~-------~--~----~

2. Problem in identifying which widget click is launching the activity?

In addition to including the appWidgetId as an extra, put it as the
PendingIntent requestCode too (assuming you aren't already using that
property of the PendingIntent for some other purpose) that will enable the
system to distinguish them.
Tom.

2009/6/8 Akash Gupta <ricky.dreamwea...@gmail.com>






--~--~---------~--~----~------------~-------~--~----~

3. GSM Modem

4. noser android comments??

5. Volume Button Broadcast?

6. Server sockets stopped working after upgrading to 1.5.

7. G1 chmod for /data folder