When I search by country name, it works perfect, but when I search for the City or places, app crashes. Here is the code:
EditText location_tf = (EditText)findViewById(R.id.TFaddress);
String location = location_tf.getText().toString();
//Toast.makeText(this, location, Toast.LENGTH_SHORT).show();
Geocoder gc = new Geocoder(this);
List<Address> list = gc.getFromLocationName(location, 1);
Address add = list.get(0);
String locality = add.getLocality();
Toast.makeText(this, locality, Toast.LENGTH_SHORT).show();
double lat = add.getLatitude();
double lng = add.getLongitude();
gotoLocation(lat, lng, 4);
thanks for the help, I found your answers help. My problem is solved, I was testing app on MIUI Chinese ROM, after installing MIUI international ROM, my code is working like a charm.
Thank you.