我有一个应用程序,其形式是用户应该填写它,我想将按钮“下一步”禁用,直到用户填写字段。我知道如何检查文本编辑,但我如何检查用户是否填写图像(图像视图将让用户从原生图库中选择图像)
我想要的: 如何检查用户是否填写图像?
if(checkEditText2(CaseName) && checkEditText2(CaseAge) && CheckRButtons(RBMale, RBFemale) && CheckSpinner(CaseDurationH, CaseDurationM )) {
Nextb.setEnabled(false);}
else {Nextb.setEnabled(true);}
}
这是如何检查编辑文本:
// For EditText
private boolean checkEditText2(EditText edit) {
return edit.getText().length() == 0;
}
答案 0 :(得分:0)
也许可以这么简单:
if (ImageView == null){
Nextb.setEnabled(false);
or
Nextb.setVisibility(View.INVISIBLE);
}else{
Nextb.setEnabled(true);
or
Nextb.setVisibility(View.VISIBLE);
}
使用位图时相同:
if (BitMap == null){
}else{
}
答案 1 :(得分:0)
要检查图像视图是否包含图像,我们需要检查图像视图的图像是否包含图像。喜欢以下
if(imageView.image == NULL){
NSLog("Image of the image-view has no image");
}
答案 2 :(得分:-1)
if (mediaPath == null)
{
Toast.makeText(getApplicationContext(), "Please Pick Image", Toast.LENGTH_SHORT).show();
} else {
// register_useraddress_detail();
}