と に 2 つの値がlatitude
ありlongitude
ます。私は鍵を持っています。Yandex Navi
このボタンには、位置情報に移動するための 2 つのオプションが必要Google Maps
です。ボタンをクリックすると、どのボタンが開きたいのか知りたいです。どうやってやるの?
1101 次
3 に答える
1
Intent.createChooser()
次のように使用できます。
String url = "yandexmaps://maps.yandex.ru/?pt=" + latitude + "" + longitude + "&z=12&l=map";
Intent intentYandex = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intentYandex.setPackage("ru.yandex.yandexmaps");
String uriGoogle = "geo:" + latitude + "," + longitude;
Intent intentGoogle = new Intent(Intent.ACTION_VIEW, Uri.parse(uriGoogle));
intentGoogle.setPackage("com.google.android.apps.maps");
String title = "Select";
Intent chooserIntent = Intent.createChooser(intentGoogle, title);
Intent[] arr = new Intent[1];
arr[0] = intentYandex;
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, arr);
startActivity(chooserIntent);
于 2018-08-17T11:43:36.717 に答える