Can I ask someone to review my code please. Its an android application that looks at pixels in the center of the bitmap and displays the values to the user. The results seems to be inaccurate when i look them up online, often appearing bluish or black. Is something missing from the code ? do i need to do something to the imageview in xml or do you think its to with the phones hardware ? Iv tried on a sony m2 and and a sony mini
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
Bitmap bp = (Bitmap) data.getExtras().get("data");
imgFavorite.setImageBitmap(bp);
}
public void pix(){
operation= Bitmap.createBitmap(bmp.getWidth(),
bmp.getHeight(),bmp.getConfig());
int height = bmp.getHeight();
int width = bmp.getWidth();
int p = bmp.getPixel(height / 2, width / 2);
int r = Color.red(p);
int g = Color.green(p);
int b = Color.blue(p);
Toast.makeText(this, String.valueOf(r) + String.valueOf(g) + String.valueOf(b), Toast.LENGTH_LONG).show();
}