android中的注销功能

android中的注销功能,第1张

概述我正在制作一种社交网络应用程序.我正在其中实现注销功能.在注销按钮上单击它应该导航到登录屏幕,但它现在导航到主页屏幕.我使用以下代码注销..IntentFilterintentFilter=newIntentFilter();intentFilter.addAction("com.package.ACTION_LOGOUT");registerReceiver

我正在制作一种社交网络应用程序.我正在其中实现注销功能.
在注销按钮上单击它应该导航到登录屏幕,但它现在导航到主页屏幕.我使用以下代码注销..

  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);

解决方法:

使用以下注销.

yourintent.setflag(Intent.FLAG_ACTIVITY_CLEAR_top|Intent.FLAG_ACTIVITY_NEW_TASK);

它可能会帮助你

总结

以上是内存溢出为你收集整理的android中的注销功能全部内容,希望文章能够帮你解决android中的注销功能所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1120020.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存