In my Android app I want to give in an EditText
field a location/city and by pressing a button I want Google maps to display that specific city.
Is that possible without giving coordinates of the city?
In my Android app I want to give in an EditText
field a location/city and by pressing a button I want Google maps to display that specific city.
Is that possible without giving coordinates of the city?
Use the Geocoder to get the coordinates then set the map's center to the result. http://developer.android.com/reference/android/location/Geocoder.html
Use Android - GeoCoder class, get Latitude, longitude from address and using it display location on Google Map..
Geocoder geoCoder = new Geocoder(this, Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocationName(
"Address", 1);
if (addresses.size() > 0) {
GeoPoint p = new GeoPoint(
(int) (addresses.get(0).getLatitude() * 1E6),
(int) (addresses.get(0).getLongitude() * 1E6));
}
} catch (IOException e) {
e.printStackTrace();
}