cmap.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{ System.out.println("Cmap initial:=lat:-"+lat+" lang:-"+lon);
Toast t=Toast.makeText(getBaseContext(),"Location"+lat+"lang:-"+lon,Toast.LENGTH_LONG);
t.show();
tlname=elname.getText().toString();
tladdr=eladdr.getText().toString();
addressInput=tlname+" "+tladdr;
System.out.println("address:-"+addressInput);
Toast t3=Toast.makeText(getBaseContext(),"Address"+addressInput,Toast.LENGTH_LONG);
t3.show();
try
{
Geocoder gc1 = new Geocoder(
getBaseContext(), Locale.getDefault());
foundAdresses = gc1.getFromLocationName(addressInput, 5);
showAdressResults.sendEmptyMessage(0);
Toast t1=Toast.makeText(getBaseContext(),"Location...."+foundAdresses,Toast.LENGTH_LONG);
t1.show();
System.out.println("faddress:-"+foundAdresses);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (foundAdresses.size() == 0)
{ // if no address found,
// display an error
Dialog locationError = new AlertDialog.Builder(
Gotask.this).setIcon(0).setTitle(
"Error").setPositiveButton(R.string.ok, null)
.setMessage(
"Sorry, your address doesn't exist.")
.create();
locationError.show();
} else
{ // else display address on map
for (int i = 0; i < foundAdresses.size(); ++i)
{
Address x = foundAdresses.get(i);
lat = (x.getLatitude() *100);
lon = (float) x.getLongitude();
System.out.println("Cmap:=lat:-"+lat+" lang:-"+lon);
}
navigateToLocation((lat * 1000000), (lon * 1000000),myMap);
}
}
});

- 7,042
- 7
- 35
- 48

- 1
- 2
-
try { Geocoder gc1 = new Geocoder(getBaseContext(), Locale.getDefault()); foundAdresses = gc1.getFromLocationName(addressInput, 5); showAdressResults.sendEmptyMessage(0); } catch (IOException e){e.printStackTrace(); }if (foundAdresses.size() == 0){err0r msg} else { for (int i = 0; i < foundAdresses.size(); ++i) {Address x = foundAdresses.get(i); lat = (x.getLatitude() *100); lon = (float) x.getLongitude(); }navigateToLocation((lat * 1000000), (lon * 1000000),myMap); – monika Apr 05 '11 at 11:21
-
paste you code by clicking edit option below ur question – Sunil Pandey Apr 05 '11 at 11:24
-
1append your problem statement also – Sunil Pandey Apr 05 '11 at 11:33
2 Answers
I have also faced this kind of issue in reverse Geo coding so i am use Google api for it. Refer this link for google api to use in reverse geocoding.

- 3,111
- 5
- 31
- 50
I faced the same problem when i was developing an app based on google maps.The problem was with the devcie ,the one which i am using did't support backend service(a kind of service comes with device) which is responsible for working of GeoCoding related APIs.So i decided to use services exposed by google to query for lat & longitude for the required Address.So just give a try.
Refer this link to know more
http://code.google.com/apis/maps/documentation/geocoding/
Please refer following links:
How can you tell when an Android device has a Geocoder backend service?
Android; Geocoder, why do I get "the service is not available"?
Here is a sample request for geocoding request to obtain Latitude and longitude from response after parsing Xml output.
There is a clear cut example in the link mentioned earlier.