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. Performance issue: Dalvik VM is >20x slower than most modern Java VMs

You'll have to use the NDK and write some native C code to do your
math, that will speed it up a lot. And use fixed point if you need
floats.

-niko



> Android?

2. Integrate ImageButton with ListActivity failed - List no longer selectable.

make sure your list item does not contains focusable children (like
buttons, imageviews)
setting android:focusable="false" usually works for buttons and so
on...




-- 

3. how to build Android RFS with out network

4. android 2.0 images

5. EditText Handling while Orientation change

6. isOverLink() function in android-webkit

7. Sync Contact to Gmail