如何检测图像视图中是否有按钮单击时的图片。我有一个显示图片和一些结果的类,但我不希望用户能够访问这些结果(按下按钮),直到结果写入该类。在您班级的xml文件中调用一个id
所以,我想我需要检查是否有图片显示在ImageView中。
因此,像:
case R.id.previous_box:
if (R.id.photoResultView == null){
//throw up a dialog box saying they need to snap a pic first.
}
Intent j = new Intent(DTF.this, Result.class);
startActivity(j);
return;
但obviouslt R.id.photoResultView == null是不这样做的正确方法?有谁知道怎么样?
坦克!
编辑:行184
if (photoResultView.getDrawable() == null) {
编辑:
case R.id.previous_box:
if (photoResultView.getDrawable() == null) {
showToast(DTF.this, "You have to take a picture first");
return;
}
Intent j = new Intent(main.this, Result.class);
startActivity(j);
return;
我把在,但它与非受迫性错误关闭 - 任何想法? – Sapp 2010-11-17 22:15:19
你能编辑你的LogCat输出到你的文章吗? – kcoppock 2010-11-17 22:17:55
photoResultView为null,它没有在视图层次结构中声明 – apps 2010-11-17 22:25:16