Skip to content Skip to sidebar Skip to footer

Last Opened Activity

My application on boot opens FirstActivity. From FirstActivity I can start: SecondActivity, ThirdActivity. When I press the Home button and then return to my app, it always opens F

Solution 1:

I found solution: This is Android System bug. For resolve this problem i put in root Activity (first started) in onCreate() method next code block:

if (!isTaskRoot()) {
            Intent intent = getIntent();
            String action = intent.getAction();
            if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && action != null && action.equals(Intent.ACTION_MAIN)) {
                finish();
                return;
            }
        }

Post a Comment for "Last Opened Activity"