title: Android geocoding. Getting an exception
body: <p>I want to get full address with geocoding and I am providing a particular position in the form of <code>LatLng</code>. But when I am running the code I am getting exception in log.</p>
  
  <p><strong>Panic.java</strong></p>
  
  <p>public class Panic extends Activity {</p>
  
  <pre><code>String address;
  TextView result;
  LatLng position;
  
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.panic);
  
      result = (TextView) findViewById(R.id.result);
  
      ActionBar action_bar = getActionBar();
      action_bar.setDisplayHomeAsUpEnabled(true);
  
      position = new LatLng(17.6913913,75.9234617);
  
      Toast.makeText(this, position.latitude + "," + position.longitude, 1).show();
  
      String FullAddress = getFullAddress();
  
      result.setText(FullAddress);
  
  }
  
  private String getFullAddress() {
  
      Geocoder gc = new Geocoder(this);
  
      List&lt;Address&gt; list = null;
      try {
          list = gc.getFromLocation(position.latitude, position.longitude, 10);
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      String add_1 = list.get(0).getAddressLine(0);
      String add_2 = list.get(0).getAddressLine(1);
      String add_3 = list.get(0).getAddressLine(2);
  
      return add_1 + ", " + add_2 + ", " + add_3 + ".";
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      int id = item.getItemId();
      if (id == android.R.id.home) {
          flag=1;
          this.finish();
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Logcat</strong></p>
  
  <pre><code>04-04 09:18:42.120: E/AndroidRuntime(30593): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.beproject.ourway/com.beproject.ourway.Panic}: java.lang.NullPointerException
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.app.ActivityThread.access$600(ActivityThread.java:149)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.os.Handler.dispatchMessage(Handler.java:99)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.os.Looper.loop(Looper.java:153)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.app.ActivityThread.main(ActivityThread.java:4987)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at java.lang.reflect.Method.invoke(Method.java:511)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at dalvik.system.NativeStart.main(Native Method)
  04-04 09:18:42.120: E/AndroidRuntime(30593): Caused by: java.lang.NullPointerException
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at com.beproject.ourway.Panic.onCreate(Panic.java:45)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.app.Activity.performCreate(Activity.java:5020)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
  04-04 09:18:42.120: E/AndroidRuntime(30593):    ... 11 more
  04-04 09:18:42.131: I/System.out(30593): [socket][2:53181] exception
  04-04 09:18:42.131: I/System.out(30593): [CDS]close[53181]
  04-04 09:18:42.132: I/System.out(30593): [socket][2] connection clients4.google.com/216.58.220.14:443;LocalPort=45123(0)
  04-04 09:18:42.133: I/System.out(30593): [CDS]connect[clients4.google.com/216.58.220.14:443] tm:90
  04-04 09:18:42.134: D/Posix(30593): [Posix_connect Debug]Process com.beproject.ourway :443 
  04-04 09:18:42.218: I/System.out(30593): [socket][/192.168.1.4:45123] connected
  04-04 09:18:42.218: I/System.out(30593): [CDS]rx timeout:0
  </code></pre>