Show google map for specific city only in android

I want to show a map for a certain city, when the user selects any city area of ​​this city, not the whole map will be displayed. I need suggestions for this kind of thing. Thanks in advance.

+3
source share
4 answers

You can open the card with intent.

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
*/
+1
source

RND , . . , . long., , . , . . . . . . , . , .

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

, Geocoder

reference

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

, . - , .

I think this is the only way. Very helpful.:)

Hope this helps!)

0
source

To do this, you must first ask the user to select a city, and then use the Geocoder class to find the lat and lng of the city after the code

    MapController mControl;
    MapView mapView;
     mapView= (MapView) findViewById(R.id.navView)
     mControl = mapView.getController();
     mControl.animateTo(GeoP); //GeoP is the geopoint of your city
0
source

All Articles