1. First of all, what do you know about the simple logout process?
A. For example, just like the apps we use often, such as QQ. When we click the Logout button, we will return to the login interface again, it is useless to press the return key again.
B. On Android to achieve this function, first you need to understand the meaning of taskstack. If you get it. Please proceed to step c below.
C. Let's start by simulating the interface. There is a button, click this button we have realized the function of logout.
2. The next step is how you can implement your logout process, the final point of this process is that you have to clearly understand that when you log off, you are actually emptying your taskstack, as long as you do this. The logout function is complete. To set intent flag here, the taskstack will be emptied when the activity jump is completed and a new taskstack will be created.
Intent logoutintent = new Intent (CTX, Loginactivity.class);
Logoutintent.setflags (Intent.flag_activity_clear_task | Intent.flag_activity_new_task);
startactivity ( logoutintent);