title: I want to get location of picture taken in android emulator
body: <p>Here is what I tried so far. Don't know what I am getting wrong. Works just fine for taking picture and setting it to ImageView, but crashes when I add the code that tries to get location.</p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
  
      if (resultCode == Activity.RESULT_OK &amp;&amp; requestCode == ACTION_IMAGE_CAPTURE) {
          new Thread(new Runnable() {
              public void run() {
                  final Bitmap bm = (Bitmap) data.getExtras().get("data");
                  Uri uri = data.getData();
                  Cursor cursor = getBaseContext().getContentResolver().query(uri, new String[] {android.provider.MediaStore.Images.ImageColumns.LATITUDE,
                          android.provider.MediaStore.Images.ImageColumns.LONGITUDE }, null, null, null);
                  if(cursor.moveToFirst()){
                      int latIndex = cursor.getColumnIndex(android.provider.MediaStore.Images.ImageColumns.LATITUDE);
                      int lonIndex = cursor.getColumnIndex(android.provider.MediaStore.Images.ImageColumns.LONGITUDE);
                      double longitu = cursor.getDouble(lonIndex);
                      double latitu = cursor.getDouble(latIndex);
                      Log.d("picloc", longitu + " "+latitu);
                  }
  
                  iv.post(new Runnable() {
                      public void run() {
                          iv.setImageBitmap(bm);
                      }
                  });
              }
  
          }).start();
      }
  </code></pre>