2012-02-28 4 views
1

私のアプリケーションでは、2つのジオポイント間の方向を示したいと思います。マップアプリケーションを使用しました。それは次のようなモバイルで提供されるさまざまなオプションを示しています。しかし、私はこれを尋ねることなく方向を示したいと思います。出来ますか?誰でも助けてください。アンドロイド - マップアプリケーションを直接開く方法

を更新しました

String directionweburl = "http://maps.google.com/maps?daddr="+dest_lat+","+dest_long+"&saddr="+source_lat+","+source_long; 

Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(directionweburl)); 

startActivity(myIntent); 

enter image description here

当初は

enter image description here

を次のように示している。しかし、私は次のように直接表示することは可能ですか?

enter image description here

答えて

7

あなたはちょうどこのhttp://developer.android.com/guide/appendix/g-app-intents.htmlを通過する必要があります。

The Geo URI scheme (not fully supported) is currently under development.が見つかります。あなたのURLリクエストをサポートしています。だから私は、現在の方法は緯度、経度、ズームとクエリの機能だけを取るので別の方法を試さなければならないと思います。

編集:このダイアログを除去するためのGoogleマップの活動のためのクラス名を設定してみてください:

String directionweburl = "http://maps.google.com/maps?daddr="+dest_lat+","+dest_long+"&saddr="+source_lat+","+source_long; 

Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(directionweburl)); 
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); 
startActivity(myIntent); 

編集2(そのが動作していないしてみてくださいいけない) このクラス名を設定してみてください:

intent.setClassName("com.google.android.apps.maps", 
"com.google.android.maps.driveabout.app.NavigationActivity"); 
+0

ありがとうございました – naresh

+0

投稿を更新しました。一度投稿を参照してください。 – naresh

+0

try intent.setClassName( "com.google.android.apps.m4ps"、 "com.google.android.maps.driveabout.app.NavigationActivity"); –

0

文字列directionweburl = "http://maps.google.com/maps?daddr="+dest_lat+","+dest_long+" & SADDR = "+ source_lat + "、" + source_long;

Intent myIntent =新しいインテント(Intent.ACTION_VIEW、Uri.parse(directionweburl)); intent.setClassName( "com.google.android.apps.maps"、 "com.google.android.maps.MapsActivity"); startActivity(myIntent);

その作業 何らかの問題が

0

文字列directionweburl = "http://maps.google.com/maps?daddr="+dest_lat+","+dest_long+" &をsaddr =」使用のGoogleのAPIシミュレータを発生した場合+ source_lat + "、" + source_long;

Intent myIntent =新しいインテント(Intent.ACTION_VIEW、Uri.parse(directionweburl)); int.setClassName( "com.google.android.apps.maps"、 "com.google.android.maps.MapsActivity"); startActivity(myIntent);

関連する問題