title: Delete/remove current image from ImageView?
body: <p>I want to delete/remove or clear image from imageView every time when user again click to set another image to  the imageView. i am getting OutOfMemoryError: bitmap size exceeds VM budget(Heap Size=7239KB, Allocated=2769KB, Bitmap Size=8748KB)
   here is my code:</p>
  
  <pre><code>ImageView imageView;
  private static final int SELECT_PICTURE = 1;
  private String selectedImagePath;
  Bitmap yourSelectedImage;
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
  
  }
  
  
  @Override
  protected void onResume() {
      super.onResume();
      imageView = (ImageView) findViewById(R.id.imageView);
  
              ((ImageView) findViewById(R.id.imageView))
      .setOnClickListener(new OnClickListener() {
  
          public void onClick(View arg0) {
  
              goToGallery();
          }
      });
  
  }
  
  
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == RESULT_OK) {
          if (requestCode == SELECT_PICTURE) {
              Uri selectedImageUri = data.getData();
              selectedImagePath = getPath(selectedImageUri);
              /*Toast.makeText(getBaseContext(), "" + selectedImagePath, 1000)
                      .show();
              *///editText2.setText(selectedImagePath);
  
              // Convert file path into bitmap image using below line.
              yourSelectedImage = BitmapFactory
                      .decodeFile(selectedImagePath);
  
              // put bitmapimage in your imageview
              imageView.setImageBitmap(yourSelectedImage);
  
  
          }
      }
  }
  
  public String getPath(Uri uri) {
      String[] projection = { MediaStore.Images.Media.DATA };
      Cursor cursor = managedQuery(uri, projection, null, null, null);
      int column_index = cursor
              .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
      cursor.moveToFirst();
      return cursor.getString(column_index);
  }
  private void goToGallery()
  {
  
  
      // in onCreate or any event where your want the user to
      // select a file
      Intent intent = new Intent();
      intent.setType("image/*");
      intent.setAction(Intent.ACTION_GET_CONTENT);
      startActivityForResult(
              Intent.createChooser(intent, "Select Picture"),
              SELECT_PICTURE);
  
  }
  </code></pre>