I am trying to get the actual path of an image so that I can upload or send to server as multipart/form-data. So, Once I get the Uri, I have below code
Uri selectedImageUri = data.getData();
File file = new File(selectedImageUri.getPath());//create path from uri
final String[] split = file.getPath().split(":");//split the path.
String path = split[1];//assign it to a string(your choice).
uri value = content://com.android.providers.media.documents/document/image%3A32
path value = 32
I don't get it why path is a number, even I tried using getcontentResolver() and with that too I am getting path =32. I am using API 29 so I can't use MediaStore.Images.Media.DATA so, I have to use MediaStore.Images.Media._ID. It would be good if someone can also tell how to upload image as form-data too once i have path.