I am using the standard android pick images from gallery way of picking images from phone.. My same code works perfectly fine on all android apart from android 5.0 and above.
I did some debugging and the problem seems to be below:
public String getPath (Uri uri) {
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
ImagePath= cursor.getString(column_index) ;
System.out.println("HERE" + ImagePath); // returns null
return cursor.getString(column_index);
}
The prinln I did returns null fOR ImagePath.. this where the problem is.. It does not return null on any other android apart from 5.0+.. How can i get this to work?