Geocoder initialization fails
问题 I am getting a NullPointerException when trying to declare the Geocoder in my application. I have the following declaration : public class MainActivity extends Activity { private Geocoder geocoder = new Geocoder(this, Locale.getDefault()); ... } I get the following LogCat : 03-20 10:48:55.729: D/AndroidRuntime(604): Shutting down VM 03-20 10:48:55.729: W/dalvikvm(604): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 03-20 10:48:56.209: E/AndroidRuntime(604): FATAL