There are some models Click icon to enter the home and then point does not preserve the issue again before the interface

Some models after clicking the Home button to return to the main page and then click on the icon to enter the program have found no previous interface.

Solution:

1, we add the following methods in the base class Activity:

  @Override
    public boolean moveTaskToBack(boolean nonRoot) {
        return super.moveTaskToBack(nonRoot);
    }

2, in onCreate program just started the page Activity () method to add:

@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!this.isTaskRoot()) {
            Intent mainIntent = getIntent();
            String action = mainIntent.getAction();
            if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
                finish();
                return;
            }
        }
    }

Most of this problem will be solved.

Guess you like

Origin blog.csdn.net/generallizhong/article/details/91950042