gpt4 book ai didi

java - 始终返回到我的应用程序的主表单/Activity

转载 作者:行者123 更新时间:2023-12-02 07:59:07 24 4
gpt4 key购买 nike

我的 Android 应用程序有一个按钮,可以执行此代码以打开指向特定应用程序的应用程序市场。

它有效。

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(getResources().getString(R.string.app_url)));
startActivity(intent);

但是,每当用户在此时退出我的应用程序(通过点击“主页”)时,下次他重新打开它(甚至几天后恢复)时,该应用程序仍然指向应用程序商店。

如何使任何“重新打开”始终返回到我的应用程序的 make 表单/Activity ?(就像他昨天退出我的应用程序时按了“返回”而不是“主页”一样。)

谢谢。

最佳答案

来自 google + android 开发者帖子。

If your application launches the activities of other applications (such as to view a picture or pick an attachment), there is an important intent flag to know:

Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

Use this when starting an activity that you don't want the user to return to if they relaunch your application from the app launcher or a shortcut on the home screen. For example, it would be confusing to tap on the Gmail icon and find yourself selecting a picture because that is the last thing you had been doing as part of the Gmail task.

关于java - 始终返回到我的应用程序的主表单/Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9167035/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com