Android project combat (fifty-five): some models Click icon to enter the home and then point does not preserve the issue again before the interface

Solution:

1, in addition method in the base class Activity

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

 

2, in the program start page Activity onCreate () method

@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;
            }
        }
    }

 

Guess you like

Origin www.cnblogs.com/xqxacm/p/11018684.html