search

Home  >  Q&A  >  body text

android - Home键app重新启动的问题

主要出现在小米手机上,在其他手机上暂时没有发现,例入在A页面时,点击home键回到桌面,再次点击app的icon,app重新启动且A页面会销毁,会到A页面之前的页面,在其他手机上别没有发现这个问题,参考网上的答案,但是不能解决

求有经验的大神指点这个问题怎么解决

和这位同学的问题类似
https://segmentfault.com/q/10...

黄舟黄舟2772 days ago517

reply all(4)I'll reply

  • 天蓬老师

    天蓬老师2017-04-18 09:07:16

    Whether the mobile phone itself has the setting of not retaining activities, you can check it in the developer options first, and then check the related security management software of Xiaomi to compare whether the same situation exists in other software.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-18 09:07:16

    Troubleshooting method, first test with other software to see if the same problem will occur. If not, check whether our current interface has destroyed the application in the life cycle method, such as System.exit(0) Let's wait and troubleshoot the problem.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-18 09:07:16

    1. If such a weird problem occurs, you should first check if other apps have similar problems. If so, it is a problem with the desktop app, go to 1.1; if not, go to 2;
    1.1. Re-download a desktop application, try again, and analyze where the pitfalls are;
    2. Check the code and XML configuration, especially AndroidManifest.xml, to see if parameters are declared that should not be declared.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:07:16

    This problem should occur during the first installation, right?
    Add the following code to your launchActivity onCreate method:

    /**
     * 解决APP打包第一次安装之后启动APP图标会出现多个程序的问题
     */
    if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
        finish();
        return;
    }

    Hope this helps you!

    reply
    0
  • Cancelreply