Closed UrbanSide closed 4 years ago
Sorry. Thiw method work
public String getPathFromUri(Uri uri, Activity activity) {
String[] projection = {MediaStore.MediaColumns.DATA};
Cursor cursor = activity.managedQuery(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
you can simply use -> Uri.parse(address); and to file -> new File(Uri.parse(address));
Is it possible to somehow make the file or uri return? I think it would be much more convenient for work, for example, with sending photos to the server or to the glide. I still was not able to understand how to change it. My method:
Return null on
String imagePath = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
Call: getImageFilePath()