Example usage for android.app Instrumentation getContext

List of usage examples for android.app Instrumentation getContext

Introduction

In this page you can find the example usage for android.app Instrumentation getContext.

Prototype

public Context getContext() 

Source Link

Document

Return the Context of this instrumentation's package.

Usage

From source file:org.onepf.opfiab.opfiab_uitest.tests.ui.UnifiedFragmentHelperTest.java

private static void reopenActivity(Instrumentation instrumentation) throws InterruptedException {
    final Context context = instrumentation.getContext();
    @SuppressWarnings("deprecation")
    final Intent intent = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE))
            .getRecentTasks(2, 0).get(1).baseIntent;
    intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    instrumentation.getContext().startActivity(intent);
    Thread.sleep(WAIT_REOPEN_ACTIVITY);
}