請建議我我是新的Android如何打開一個內置的谷歌地圖按鈕點擊在Android我有一個圖像按鈕。 如何打開按鈕打開內置谷歌地圖點擊如何打開內置打開谷歌地圖上按鈕點擊
1
A
回答
2
願這可以幫助你。
實施例: -
btn_click.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Uri gmmIntentUri = Uri.parse("geo:0,0?q=");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
}, 1000);
}
});
2
過去這段代碼中的onclick聽者
String uri = "http://maps.google.com/maps?saddr=" + sourceLatitude + "," + sourceLongitude + "&daddr=" + destinationLatitude + "," + destinationLongitude;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
0
字符串URI = 「http://maps.google.com/maps?saddr=」 + sourceLatitude + 「」 + sourceLongitude + 「& DADDR =」 + destinationLatitude + 「」 + destinationLongitude;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setPackage(「com.google.android.apps.maps」);
startActivity(intent);
怎麼樣sourceLatitude和經度其示值誤差@sagar帕特爾 –
添加位置的緯度和經度 – 2017-04-05 07:04:00
我先生怎麼不知道 –