'why ActivityResultContracts.GetContent()/TakePicturePreview does return file
I am uploading a file as multipart using retrofit
val requestIdentityFrontSideFileMultipartBody =identityFrontSide?.asRequestBody("image/${identityFrontSide.extension}".toMediaTypeOrNull())
?.let {
MultipartBody.Part.createFormData(
"identityFrontSide",
"identityFrontSide.${identityFrontSide.extension}",
it
)
}
however
val launcher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.GetContent(),
onResult = { uri:Uri ->
val launcher =
rememberLauncherForActivityResult(ActivityResultContracts.TakePicturePreview()) {
}
ActivityResultContracts.GetContent() return Uri from gallery
ActivityResultContracts.TakePicturePreview() return bitmap
I don't understand why ActivityResultContracts does not return files
and how I can upload uri/bitmap to retofit without convert them to files because that not working for me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
