test

A collection of 14 posts
NullPointerException - getInstrumentation().getContext()
android

NullPointerException - getInstrumentation().getContext()

Here's a beginner mistake... The following code: public class ReactiveApiTest extends InstrumentationTestCase { protected LocalJsonClient mLocalJsonClient; public ReactiveApiTest() { super(); mLocalJsonClient = new LocalJsonClient( getInstrumentation().getContext() ); } // ... } Throws an exception: Attempt to invoke virtual method 'android.content.Context android.app.Instrumentation.getContext()' on a null object reference It to
1 min read