我正在使用一个包含 StringArray 列表的对话框。我想在单击 StringArray 的项目时关闭对话框。但双击后它被解雇了。
谢谢。
final Dialog dialog = new Dialog(Disease.this);
dialog.setCancelable(true);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
final ListView listSpecialityView = new ListView(Disease.this);
listSpecialityView.setCacheColorHint(Color.TRANSPARENT);
listSpecialityView.setAdapter(adapter_list);
listSpecialityView
.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
// Txt_Speciality.setText(Speciality_array[arg2]
// .toString());
// String id = String.valueOf(arg2);
if(immunString.equalsIgnoreCase("immun")){
data = immunizationsStrings[arg2];
}else {
data = Drugs[arg2];
}
showDialog(1);
dialog.dismiss();
//dialog.dismiss();
}
});
dialog.setContentView(listSpecialityView);
dialog.show();