2

getFromLocationName() alsways throws a NullPointerException in the Android 2.2 emulator but it's working fine in the Android 1.6 emulator.

This is my code snippet:

Geocoder geo = new Geocoder(GeocoderAppActivity.this, Locale.getDefault());     

try {       
    List<Address> add = geo.getFromLocationName("Tagore Road,Rajkot", 1);
    while (add.size() == 0) {
        Log.e("Girish", "in while");
        add = geo.getFromLocationName("Tagore Road,Rajkot", 1);
    }
}

What is wrong?

Octavian Helm
  • 39,405
  • 19
  • 98
  • 102

3 Answers3

0

In the emulator, are you using the regular Android 2.2, or the Google Apis [Android 2.2] version?

If you use the regular Android 2.2 one, it won't work. As far as I know it does not have the functionality to fulfill your actions. Open your SDK manager and download the Google Apis [Android 2.2] and create an AVD with that. Then try again, it should work.

Sander van't Veer
  • 5,930
  • 5
  • 35
  • 50
  • ya i know that i am using google api 2.2 and tested in google api 2.2. –  Dec 14 '11 at 14:02
0

It's a known bug which they never fixed see service not available I think you will find that it works in the the API level 7 emulator.

NickT
  • 23,844
  • 11
  • 78
  • 121
0

Yes this is a Bug but I think it shall run on device.

Arun Badole
  • 10,977
  • 19
  • 67
  • 96