How to wake up MainActivity

My app has 3 activities; MainActivity has a large ImgeView with a jpg picture in main layout.

Activities are changed with this code:

    Intent i = new Intent(this, Activity1.class);
    startActivityForResult(i,70);// arbitrary

and back to MainActivity with code:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
            case 70: // do something on return

My problem is that during the time spent in activity1, MainActivity goes to sleep (not sure if the right word) and the picture is dimmed and looking wrong.

android:keepScreenOn="true" in layout does not work
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // not working

I have added in manifest:
"android.permission.WAKE_LOCK"

How to keep the image bright?

Source: Android Questions

LEAVE A COMMENT