Logout function in Android
•
Android
I'm making a social networking application. I'm implementing the sign out function. Clicking on the sign out button should navigate to the login screen, but it now navigates to the home screen. I sign out using the following code
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("com.package.ACTION_logoUT");
registerReceiver(new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
System.out.println("onReceive Log out in progress");
Intent intent1 = new Intent(getApplicationContext(), Login.class);
startActivity(intent1);
finish();
}
}, intentFilter);
resolvent:
Sign out using the following
yourintent.setflag(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
It may help you
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码