I want to add remove option in image chooser intent, I successfully added gallery option and camera option and those are working fine but I want to add remove option, if I choose remove option the image should remove from imageview.
Thanks in advance :)
My Code:
public void edit_profile_pic(View view) {
Uri uri = null;
Intent GalleryIntent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
Intent CameraIntent =new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
CameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
Intent chooserIntent = Intent.createChooser(CameraIntent, "Choose");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {GalleryIntent, CameraIntent});
startActivityForResult(chooserIntent, RESULT_LOAD_IMG);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
ImageView imageView = (ImageView) findViewById(R.id.profile_profile_picture);
if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK)
{
Bitmap bitmap = null;
if(data.getData()!=null)
{
try
{
InputStream stream = getContentResolver().openInputStream(data.getData());
bitmap = BitmapFactory.decodeStream(stream);
stream.close();
imageView.setImageBitmap(bitmap);
}
catch (Exception e)
{
e.printStackTrace();
}
}
else
{
bitmap=(Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(bitmap);
}
super.onActivityResult(requestCode, resultCode, data);
}
}