title: Deprecated android method replacement getPath()
body: <p>I have this <code>getPath</code> method, it works, but I want to get rid of the warning because it says that the <code>managedQuery</code> method is deprecated. How can I implement this exact <code>getPath</code> method with no warnings? Thank you.</p>
  
  <pre><code>public String getPath(Uri uri) {
          System.out.println("IM IN getPath");
          String[] projection = { MediaStore.Images.Media.DATA };
          Cursor cursor = managedQuery(uri, projection, null, null, null);
          int column_index = cursor
                  .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
          cursor.moveToFirst();
          return cursor.getString(column_index);
      }
  </code></pre>
  
  <p>EDIT: Im getting this logcat error now:</p>
  
  <pre><code>10-23 07:19:14.080: E/ActivityThread(594): Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1@416c9560 that was originally registered here. Are you missing a call to unregisterReceiver()?
  10-23 07:19:14.080: E/ActivityThread(594): android.app.IntentReceiverLeaked: Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1@416c9560 that was originally registered here. Are you missing a call to unregisterReceiver()?
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.LoadedApk$ReceiverDispatcher.&lt;init&gt;(LoadedApk.java:763)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:567)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1043)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.ContextImpl.registerReceiver(ContextImpl.java:1030)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.ContextImpl.registerReceiver(ContextImpl.java:1024)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:341)
  10-23 07:19:14.080: E/ActivityThread(594):  at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:65)
  10-23 07:19:14.080: E/ActivityThread(594):  at com.android.internal.app.ResolverActivity.onCreate(ResolverActivity.java:99)
  10-23 07:19:14.080: E/ActivityThread(594):  at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:53)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.Activity.performCreate(Activity.java:4465)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.os.Handler.dispatchMessage(Handler.java:99)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.os.Looper.loop(Looper.java:137)
  10-23 07:19:14.080: E/ActivityThread(594):  at android.app.ActivityThread.main(ActivityThread.java:4424)
  10-23 07:19:14.080: E/ActivityThread(594):  at java.lang.reflect.Method.invokeNative(Native Method)
  10-23 07:19:14.080: E/ActivityThread(594):  at java.lang.reflect.Method.invoke(Method.java:511)
  10-23 07:19:14.080: E/ActivityThread(594):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  10-23 07:19:14.080: E/ActivityThread(594):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  10-23 07:19:14.080: E/ActivityThread(594):  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>