I have followed some examples on SO of how to retrive an image from Camera or Gallary. The camera part works, but the gallary part dosn\'t. The code seems very diffuclt to under
Use below code to pick image from Gallery.
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
//Here PICK_FROM_GALLERY is a requestCode
startActivityForResult(intent, PICK_FROM_GALLERY);
In onActivityResult():
if (resultCode == Activity.RESULT_OK && requestCode == PICK_FROM_GALLERY) {
if (data.getData() != null) {
mImageUri = data.getData();
} else {
//showing toast when unable to capture the image
Debug.toastValid(context, "Unable to upload Image Please Try again ...");
}
}