i am using the following code to get the latitude and longitude values of a particular area.
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
List<Address> foundGeocode = null;
/* find the addresses by using getFromLocationName() method with the given address*/
try {
foundGeocode = new Geocoder(this).getFromLocationName("Hyderabad", 1);
foundGeocode.get(0).getLatitude(); //getting latitude
foundGeocode.get(0).getLongitude();//getting longitude
Toast.makeText(this, ""+ foundGeocode.get(0).getLatitude()+" "+foundGeocode.get(0).getLongitude(), 20).show();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
But the catch block is being executed instead of getting the latitude and longitude values.
Can any one help me out.
I sent values to emulator using the ddms view and later tried to work out this code.
i am getting the following warning.
07-13 09:05:13.390: W/System.err(368): java.io.IOException: Service not Available
thanks in advance.