I know the question has been asked frequently before ,but i am unable to get the solution from any answer or search results. I have to solve this issue ASAP .. I am trying t
I dont know if it helps BTW below is snippet from my project working fine modify it to suit your needs
String newAddress = saveas.getText().toString();
searchFromLocationName(newAddress);
private void searchFromLocationName(String name){
try {
List result
= myGeocoder.getFromLocationName(name, MAX_RESULT);
if ((result == null)||(result.isEmpty())){
Toast.makeText(AndroidgetFromLocationNameActivity.this,
"No matches were found or there is no backend service!",
Toast.LENGTH_LONG).show();
}else{
MyArrayAdapter adapter = new MyArrayAdapter(this,
android.R.layout.simple_list_item_1, result);
listviewResult.setAdapter(adapter);
Toast.makeText(AndroidgetFromLocationNameActivity.this,
"Finished!",
Toast.LENGTH_LONG).show();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Toast.makeText(AndroidgetFromLocationNameActivity.this,
"The network is unavailable or any other I/O problem occurs!",
Toast.LENGTH_LONG).show();
}
}