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

by Dianne Hackborn » Fri, 06 Mar 2009 04:12:05 GMT

Sponsored Links
 The framework runs the instrumentation independently of the app, so it can
do what it wants when it wants.  And an activity is not "the app".
Activities are created all the time, you can't wait for whatever one to be
created before running the instrumentation. #onStart() #runOnMainSync(java.lang.Runnable)

Dianne Hackborn
Android framework engineer

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. Front Camera di Xperia X10

Mohon pencerahan dari para suhu,

Di Sony Ericsson X10 kan ada kamera depan tuh, kira-kira ada yang tau ga
fungsinya buat apa?
Buat video call, ga tau gimana cara penggunaannya..
Buat video - skype, emang dah bisa? Ada yang pernah coba?
Buat foto-narsis, kok ga bisa deh kayanya..?

Ada yang bisa membantu kah?


"Indonesian Android Community [id-android]" 

2. Access active window from a background service

I hope not.


3. SocketChannel, broken pipe exception - Cupcake only

4. Access active window from a background service

5. Translucent theme turns black when using startActivityForResult

6. problem in installing ADT Plugin for Eclipse

7. RelativeLayout bug ?