title: How to Get Pixel Color in Android
body: <p>I'm using Intent to call and show an image from Gallery, and now I made it enable to get me the coordinates of the image in a TextView using these:</p>
  
  <pre><code>final TextView textView = (TextView)findViewById(R.id.textView); 
  final TextView textViewCol = (TextView)findViewById(R.id.textViewColor);
  targetImage.setOnTouchListener(new ImageView.OnTouchListener(){     
      @Override   
      public boolean onTouch(View v, MotionEvent event) {
          // TODO Auto-generated method stub       
          int x=0;
          int y=0;
          textView.setText("Touch coordinates : " +       
          String.valueOf(event.getX()) + "x" + String.valueOf(event.getY()));
          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);
          if(pixel == Color.RED){
                 textViewCol.setText("It is RED");
              }
  
          /*if(redValue == 255){
              if(blueValue == 0)
                  if(greenValue==0)
                 textViewCol.setText("It is Red");
              }*/
          return true;    }     
      });
  </code></pre>
  
  <p>Now what I need to do is; to get the <code>color (RGB value)</code> of the exact coordinates the user selects and later on assign each to <code>#FF0000</code>, <code>#00FF00</code> and <code>#0000FF</code> but for now, please help to get the Pixel color based on what I have.</p>
  
  <p>Cheers.</p>