Code example for Instrumentation

Methods: callActivityOnPausecallActivityOnResume

0
 
		Instrumentation mInstr = this.getInstrumentation();
 
		// Use instrumentation to call the Activity's onPause() 
 
		mInstr.callActivityOnPause(currentActivity);
 
		/* Under test, the activity is waiting for input. The invocation of 
		 * callActivityOnPause(android.app.Activity) performs a call directly to the activity's onPause() 
		 * instead of manipulating the activity's UI to force it into a paused state. */ 
 
		// Test if location were disabled 
		assertNull(testLocMgr);
 
		/* This ensures that resuming the activity actually restores the location manager rather than simply 
		 * leaving it as it was. */ 
 
		// Use instrumentation to call the Activity's onResume(): 
		mInstr.callActivityOnResume(currentActivity);
 
		/* Invoking callActivityOnResume(android.app.Activity) affects the activity in a way similar to 
		 * callActivityOnPause. The activity's onResume() method is invoked instead of manipulating the 
		 * activity's UI to force it to resume. */ 
 
Connect your IDE to all the code out there  Get Codota for Java