【问题标题】:An android OS level bug launcher activity launch always始终启动 android 操作系统级别的错误启动器活动
【发布时间】:2016-09-14 09:19:55
【问题描述】:

当我们从 Google Play 商店以外的源安装应用程序时,有两个选项,完成和安装完成后打开。那么应用程序的行为在这两种情况下都是不同的。当我们单击完成时,它按预期完美运行,但单击打开按钮时,每次单击应用程序图标时应用程序从后台切换到前台时(即使在应用程序被强制终止后),启动器活动都会放置在活动堆栈的顶部仅来自最近的应用程序托盘,而不是来自最近的应用程序托盘。

【问题讨论】:

    标签: android


    【解决方案1】:

    您必须检查启动器活动是否放置在活动堆栈顶部,如果它在堆栈顶部,则清除或完成活动-

    Put below code on the onCreate() of launcher activity-
    
    final Intent intent = getIntent();
    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0
            && intent.hasCategory(Intent.CATEGORY_LAUNCHER)
            && intent.getAction() != null
            && intent.getAction().equals(Intent.ACTION_MAIN)) {
        finish();// finish this launcher activity
        return;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-26
      • 1970-01-01
      • 1970-01-01
      • 2020-03-27
      相关资源
      最近更新 更多