简体   繁体   English

Android-打算在我的应用程序之外启动活动

[英]Android - Intent to start an activity outside my application

I have this code 我有这个代码

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

It works fine an open an activity to configure location settings. 它可以很好地打开活动来配置位置设置。

But it opens the location settings activity inside my Application. 但这会在我的应用程序内打开位置设置活动。 I want it to start the Settings Application and it should show location settings inside Settings application. 我希望它启动“设置应用程序”,并且应该在“设置”应用程序中显示位置设置。 ie Start its own Application 即启动自己的应用程序

尝试

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM