Cannot Resolve method getActivity()); : I am trying to take a screenshot while doing an esspresso test 
here is my code and i cannot resolve the method getActivity and ive tried using this and that didnt work ethier.
    
    @RunWith(AndroidJUnit4.class)
    @LargeTest
    
    // Name of the activity + Test
    public class Screencap {
        //Strings to be typed into tests declaration
        public static final String STRING_TO_BE_TYPED = "Test1233";
        public static final String loginID = "LIFEHEALTH";
        public static final String Device = "TestDevice";
    
    
        /**
         * A JUnit {@link Rule @Rule} to launch your activity under test. This is a replacement
         * for {@link ActivityInstrumentationTestCase2}.
         * <p>
         * Rules are interceptors which are executed for each test method and will run before
         * any of your setup code in the {@link Before @Before} method.
         * <p>
         * {@link ActivityTestRule} will create and launch of the activity for you and also expose
         * the activity under test. To get a reference to the activity you can use
         * the {@link ActivityTestRule#getActivity()} method.
         */
        //Rule that tells the system which screen to start/boot up on this is telling the device to start from the main menu screen.
        @Rule
        public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(
                MainActivity.class);
    
        //@Test must be there to start a test if this is missing it will not run the test
        @Test
        public void Screencap1 () { /* passes*/
            //Enters login
            onView(withId(R.id.editOid)) /*editTextUserInput*/
                    .perform(typeText(loginID), closeSoftKeyboard());
            // then click next
            onView(withId(R.id.btn_next)).perform(click());
            // "Clicks the settings
            onView(withId(R.id.btnSettings)).perform(click());
            //Clicks Device Settings.
            onView(withText("Device Settings")).perform(click());
            //Scroll up
            onView(withText("Configure IRMA Base")).perform(swipeUp());
            onView(withText("Configure IRMA Base")).perform(swipeUp());
            onView(withText("Configure IRMA Base")).perform(swipeUp());
            onView(withText("Configure IRMA Base")).perform(swipeUp());
            onView(withText("Configure IRMA Base")).perform(swipeUp());
            onView(withText("Configure IRMA Base")).perform(swipeUp());
            onView(withText("Barcode Reader Timeout")).perform(swipeUp());
            onView(withText("Barcode Reader Timeout")).perform(swipeUp());
            onView(withText("Barcode Reader Timeout")).perform(swipeUp());
            //language
            onView(withText("Language")).perform(doubleClick());
*this is where the issue is*

            HelperClass.takeScreenshot("Whatever you want to call the file", getActivity());

    
    //wait 1 min
            try {
                Thread.sleep(1 * 60 * 1000);
            } catch (InterruptedException e) {
    
            }
            /* Clicks back button */
            onView(withId(R.id.btn_back)).perform(click());
            //clicks main menu button
            onView(withText("Main Menu")).perform(click());
    
        }
    
    
    
    }

