I want to upload image to server using Retrofit. I'm Getting my Image from Camera App & from Gallery.
here you can see my onActivityResult method on Below code Camera image using Bitmap & Gallery image using Uri, is there way to send both type of image in server using Retrofit.
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == TAKE_PICTURE) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
profile.setImageBitmap(photo);
} else if (requestCode == ACTIVITY_SELECT_IMAGE) {
Uri imgUri = data.getData();
profile.setImageURI(imgUri);
}
}
I don't have idea how to upload image to server please.