为什么点击按钮没反应
下面代码我想实现一个消除孤立像素点的程序,判断一个黑色点周围四个点是不是都是白色,如果是就把它也变成白色,但是为什么没反应?bt1.setOnClickListener(new OnClickListener(){
public void onClick(View v){
mB = ba.getWidth();
mB2 = ba.getHeight();
for ( j = 0; j < mB2; j++) {
for (i = 0; i < mB; i++) {
color = ba.getPixel(i, j);
int r = Color.red(color);
int g = Color.green(color);
int b = Color.blue(color);
if (r==0&g==0&b==0){
color2 = ba.getPixel(i, j-1);
color3 = ba.getPixel(i, j+1);
color4 = ba.getPixel(i-1, j);
color5= ba.getPixel(i+1, j);
int r2 = Color.red(color2);
int g2= Color.green(color2);
int b2 = Color.blue(color2);
int r3 = Color.red(color3);
int g3 = Color.green(color3);
int b3 = Color.blue(color3);
int r4 = Color.red(color4);
int g4 = Color.green(color4);
int b4 = Color.blue(color4);
int r5 = Color.red(color5);
int g5 = Color.green(color5);
int b5 = Color.blue(color5);
if ((r2==255&g2==255&b2==255)&(r3==255&g3==255&b3==255)&(r4==255&g4==255&b4==255)&(r5==255&g5==255&b5==255)){
ba.setPixel(j,i,Color.WHITE);
}
}
}
}
}
});