Why In A Test Class That Extends Androidtestcase, Does Getcontext() Return Null?
I have my own SQLiteOpenHelper as follow : public class MyOpenHelper extends SQLiteOpenHelper { public static final int DB_VERSION = 1; public static final String DB_NAME = '
Solution 1:
For accessing a context
you can:
- Extend from InstrumentationTestCase and then call
getInstrumentation().getContext()
- Use reflection to access a private member
You can see code samples at this answer
Post a Comment for "Why In A Test Class That Extends Androidtestcase, Does Getcontext() Return Null?"