Code example for Instrumentation

Methods: addMonitorinvokeMenuActionSyncwaitForMonitorWithTimeout

     * @return A reference to the child activity which is launched, if the test 
     * succeeds. 
    public static Activity testMenuItem(Instrumentation inst, Activity activity, int menuId, Class<? extends Activity> childActivityClass) {
        Instrumentation.ActivityMonitor monitor = new Instrumentation.ActivityMonitor(childActivityClass.getName(), null, false);
        Assert.assertTrue(inst.invokeMenuActionSync(activity, menuId, MENU_FLAGS));
        Activity childActivity = inst.waitForMonitorWithTimeout(monitor, TIME_OUT);
        Assert.assertEquals(childActivityClass, childActivity.getClass());
        return childActivity;
     * Add a card to the database using the {@link EditText} views from the 
     * given {@link BaseballCardDetails} activity and check that the save button 
Connect your IDE to all the code out there  Get Codota for Java