Android - Intent 在我的应用程序之外开始一个 Activity

标签 android android-intent

我有这个代码

Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
PackageManager packageManager = getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0);
boolean isIntentSafe = activities.size() > 0;
    if (isIntentSafe) {
       startActivity(intent);
    }

打开一个 Activity 来配置位置设置工作正常。

但它会在我的应用程序中打开位置设置 Activity 。我希望它启动设置应用程序,它应该在设置应用程序中显示位置设置。即启动自己的应用程序

最佳答案

尝试

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

关于Android - Intent 在我的应用程序之外开始一个 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27623088/

相关文章:

android - 使网站页面大小在移动设备中为正常桌面大小

android - 如何保持第二次 Activity 的 Intent ?

android - 从设置中清除数据后服务停止

java - Android:比较日历日期

java - Android登录与字符串响应

android - 如何在 Play 商店中发布我的第二个应用程序?

android - 如何将 Html 文本共享到 whatsapp Intent

android - 通过 Intent 将 BluetoothDevice 对象传递给另一个 Activity

android - 如何防止通过蓝牙输入设备在一个 Activity 中接收到的输入传播到此 Activity 完成后开始的其他 Activity

android - 通过 Intent.ACTION_SEND 共享文件时,Google 云端硬盘将文件名更改为 Intent.EXTRA_SUBJECT