2012-04-25 11 views

答えて

1

インテントでマップを開くことができます。ここで

String uri = "geo:"+ latitude + "," + longitude; 
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri))); 

// You can also choose to place a point like so: 
String uri = "geo:"+ latitude + "," + longitude + "?q=my+street+address"; 
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri))); 

/* 
* The Possible Query params options are the following: 
* 
* Show map at location: geo:latitude,longitude 
* Show zoomed map at location: geo:latitude,longitude?z=zoom 
* Show map at locaiton with point: geo:0,0?q=my+street+address 
* Show map of businesses in area: geo:0,0?q=business+near+city 
*/ 
0

、私たちは、各都市の緯度経度&が何であるかを、各都市のRNDを行う必要があります。緯度は&です。各都市に行く必要はありませんが、緯度を確認します。長くて、簡単なやり方はFind coordinates by moving around the mapです。 だからすべての緯度を取得した後。長いです。各都市ごとにこの緯度を使用してください。 &が長い。ユーザの都市選択に従って地図を表示する。したがって、特定の領域が表示されます。 したがって、地図を表示するのにlatitude &経度を使用する方法を次のコードで確認してください。

Intent intent = new Intent(Intent.ACTION_VIEW); 
      intent.setData(Uri.parse("geo:0,0?q=" + ("40.7890011, -124.1719112"))); 
      try { 
       startActivity(intent); 
      } catch (Exception e) { 
       e.printStackTrace(); 
      } 

希望すると、これが役立ちます。おかげ

0

はジオコーダ

呼ばれ、その目的のために良いクラスは、ここであなただけの方法

getFromLocationName("My Particular city", ...) 

を使用して、それに一致する場所のリストを取得することができreference

があります。まず最初に必要なものがあります。

これは唯一の方法だと思います。しかし、非常に便利です。そのため:)

希望、それが助けた!)

0

まずあなたが都市を選択するようにユーザーに依頼する必要があり、コード

MapController mControl; 
    MapView mapView; 
    mapView= (MapView) findViewById(R.id.navView) 
    mControl = mapView.getController(); 
    mControl.animateTo(GeoP); //GeoP is the geopoint of your city 
次の緯度と都市の使用のLNGを見つけるために、 Geocoderクラスを使用します
関連する問題