I am selecting a picture from the android device library as follows
public static void showFileChooser(Activity activity) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
activity.startActivityForResult(Intent.createChooser(intent, "Select Picture"), 1);
}
and trying to get realPathFromURI
as follows, but idx always returns -1. I wonder what I am missing.
Manifest file
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Update 1:
Update 2: I even tried the following, path returns null