我有一个布尔值,它根据方法结果返回True或False。将文本更改为True或False
我想制作一个大文本,每次根据该布尔值写入TRUE或FALSE。
我该怎么做?
这是一个爆裂相机。
事情是,我使用相机作为按钮,每次有人触摸相机时它都会返回FALSE,并且每次相机拍摄照片时都没有人将其设置为黑暗,则会返回TRUE。
当FALSE发生时,相机将转到另一个活动。
TRUE和FALSE事情工作得很好,但我只能在我的日志中检查它。
我只想要一个按钮,而不是在应用程序UI中写入文本。
public static boolean ImagemEscura(Bitmap img)
{
float totalpixel = img.getWidth() * img.getHeight();
float totalpixelescuro = 0;
for(int x = 0; x < img.getWidth(); x++)
{
for(int y = 0; y < img.getHeight(); y++)
{
int cor = img.getPixel(x, y);
if(SomaRGB(cor) > 90)
{
totalpixelescuro++;
}
}
}
return totalpixelescuro/totalpixel > 0.75f;
}
public static int SomaRGB(int cor)
{
return getRed(cor) + getGreen(cor) + getBlue(cor);
}
public static int getRed(int argb)
{
return argb >> 16 & 0xFF;
}
public static int getGreen(int argb)
{
return argb >> 8 & 0xFF;
}
public static int getBlue(int argb)
{
return argb & 0xFF;
}
}
邮政你写的代码来实现这一点。 – csmckelvey