I'm creating a program that can select image from gallery and after selected, the text next to the image will change to "Delete" for delete the image. I have worked on select image from gallery, and now I don't know how to make the delete function. Can someone please help! And here is my code. Where I should put the delete.
addPhotoText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            selectNewsFeedImage();
        }
    });
.....else if (items[item].equals("Choose from Gallery")) {
                Intent i = new Intent();
                i.setType("image/*");
                i.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(i, "Select File"), RESULT_LOAD_IMAGE);
            }
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == RESULT_LOAD_IMAGE && data != null) {
            Bitmap bm = null;
            try {
                bm = MediaStore.Images.Media.getBitmap(getApplicationContext().getContentResolver(), data.getData());
            } catch (IOException e) {
                e.printStackTrace();
            }
            addPhotoIcon.setImageBitmap(bm);......
 
     
    