Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中隐藏意图?_Android - Fatal编程技术网

如何在android中隐藏意图?

如何在android中隐藏意图?,android,Android,我有一个使用谷歌地图的应用程序。在我的例子中,我打开谷歌地图,从一个活动的外部。我做了以下几件事 Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri .parse("http://maps.google.com/maps?daddr=" + latitude + "," + longitude + "&mode=driving")); notificationIntent.setFlags(

我有一个使用谷歌地图的应用程序。在我的例子中,我打开谷歌地图,从一个活动的外部。我做了以下几件事

Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri
            .parse("http://maps.google.com/maps?daddr=" + latitude + "," + longitude + "&mode=driving"));
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

notificationIntent.setPackage("com.google.android.apps.maps");
notificationIntent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");

context.startActivity(notificationIntent);

但当我打开地图时,它会显示在我的应用程序上。我需要避免在我的应用程序上显示地图。换句话说,我的应用程序应该是顶级应用程序。有没有办法做到这一点?

你想在你的应用程序中打开谷歌地图,但你的应用程序将保持在顶部,而GMAP将保持在后台?我说得对吗?是的。这就是我想要的。:)嗯,当有人想要它时,用例是什么?你不能这样做,每当你开始一个意图时,它总是在当前活动的顶部打开。如果您想在后台做一些事情,请使用
服务
@AkashSingh您希望服务如何解决这个问题?