Basically there are two hindrances as follows:

1. I want to fetch the background color of a image at the coordinate that the cursor was clicked. The code is fetching the color as well as the coordinate for the first time. But when I'm clicking again an error occurs.
2. I would like to fetch the color of the image in hex not in RGB integer values and then change that particular color with mine in that particular area wherever the color was found.

Here's the code:

```
private ImageView mImageView;
private Button button;

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.vp_view_img);

    if(getIntent().hasExtra("BitmapImage")) 
    {
        final Bitmap bitmap = (Bitmap) getIntent().getParcelableExtra("BitmapImage");

        mImageView = (ImageView) findViewById(R.id.canvas_image);
        mImageView.setImageBitmap(bitmap);
        mImageView.setOnTouchListener(new ImageView.OnTouchListener()
        {     
            @Override   
            public boolean onTouch(View v, MotionEvent event)
            {
                int x = (int)event.getX();
                int y = (int)event.getY();

               /*Toast.makeText(getBaseContext(), "Touch coordinates : "
                                     + String.valueOf(event.getX()) + "x"
                                     + String.valueOf(event.getY()),
                                     Toast.LENGTH_SHORT).show();*/
                ImageView imageView = (ImageView) v;
                Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap();
                int pixel = bitmap.getPixel(x,y);
                int redValue = Color.red(pixel);
                int blueValue = Color.blue(pixel);
                int greenValue = Color.green(pixel);

                Toast.makeText(getBaseContext(), "Color Code :"+
                    redValue+blueValue+greenValue,Toast.LENGTH_SHORT).show();
                return true;    
                }    
            });
    }
    else
    {
        Toast.makeText(getBaseContext(), 
                "No Image Found", 
                Toast.LENGTH_LONG).show();
    }
}

```