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.

 http://developer.android.com/reference/android/app/Instrumentation.html 

 http://developer.android.com/reference/android/app/Instrumentation.html #onStart()

 http://developer.android.com/reference/android/app/Instrumentation.html #runOnMainSync(java.lang.Runnable)








-- 
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. packagemanager aidl files

hi all,
I use the android 2.2 source code, but when I read the source code of
packagemanager located in frameworks/base/core/java/android/content/pm/

there are some files such as PackageInfo.aidl, PackageInfoLite.aidl,so I
wonder that aidl file name begin with the I letter, but these file are not.

and I found that these files seems to have not used.

because the PackageInfo class defined in PackageInfo.java implements
from Parcelable.


thanks in advance.

-- 

2. EVO 4G - ROM & Myn Warm 2.2

Dear RR,

abis coba2 pakai ROM lain di Evo, dari yg sebelumnya blm berani ganti dari
yg official.

Setelah coba pakai ROM Manager, ternyata relatif mudah yah, tidak seperti yg
saya bayangin sebelumnya (atau jangan2 emang belum ketemu batunya yah :D:D)

Nah, ada beberapa hal yg ingin saya tanyakan terkait ROM, mudah2an ada RR yg
berkenan membantu, mengingat mata kuliah Androidisme ini ternyata per
semester 4 SKS dan terdiri dari Androidisme 1-3 yg totalnya jadi 12 SKS.
Piuhhh

1. Apakah ROM sama dengan merubah tampilan saja, dan tentunya dengan package
yg lebih luas atau adakah pengertian lainnya yg lebih tepat ?
2. Apa Kernel itu juga termasuk di dalam ROM ?
3. Kalau misalnya sebelum mengganti ROM sudah dilakukan nandroid backup,
apakah pasti dapat kembali ke kondisi saat backup setelah perubahan2 yg
dilakukan di ROM2 yg berbeda dgn melakukan restore ?
4. Apa ada relevansi antara ROM yg di pakai (terlepas dari pemakaian/data
activity. jadi dianggap sama) dengan kecepatan dan ketahanan battery ?
5. Yang terakhir saya sedang coba Myn Warm 2.2 dan ada informasi seperti di
bawah.

*Alternative Recommended Kernels:*

   - HTC Stock 2.6.32.15-g59b9e50 #17
Kernel<http://www.mediafire.com/?fcdvv95azbd8l9c> (Comes
   with RLS 4) - Use this if you want to revert back to stock Kernel.
   - Ziggy471 Warm TwoPointTwo RLS4
Kernel<http://www.mediafire.com/?s6s8f5nzlmrnsda>
   - 
netarchy-toastmod-4.2.1-cfs-bfq-havs-more-smartass-universal-signed<http://www.mediafire.com/?scgoar566iycseq>
   - HTC Stock 2.6.32.15-g0f673ed #10
Kernel<http://www.mediafire.com/?4bg4h1nzfe8pdhy>
   - Kings #11 CFS Kernel <http://www.mediafire.com/?xrbep2cexknnfo2>
   - Kings #9 BFS Kernel <http://www.mediafire.com/?uxsbg3p38c5pw3h>

 Nah, yg pertama itu, apakah artinya saya tidak bisa revert balik kalau
menggunakan selain yg point 1 ? dan apakah bedanya dari penggunaan kernel2
lainnya ? mungkin ada link yg bisa membantu ?


Maaf kalau jadi banyak pertanyaannya.

Terimakasih.

-- 
Rgds,

Petra Immanuel

-- 
===============
"

3. screen brightness change

4. Creating iPhone style bubble list view in android

5. Udah ada yg coba froyo resmi utk Liquid ?

6. Permintaan Maap - Was Wta : pasarmalem?

7. The Natives are Restless