我有个问题。在我的活动中,我有一个按钮,当我单击它时,我会调用一个方法。此方法向我显示一个带有列表视图的警报对话框,我想将项目单击保存到一个变量,然后我想关闭该方法但它没有关闭!!!为什么??我发布了该方法的代码。我的 logcat 没有给我任何错误。谁能帮我??请
private void getValuta() {
AlertDialog.Builder miaAlert = new AlertDialog.Builder(this);
final ListView lV = new ListView(this);
Cursor c = null;
miaAlert.setTitle("Choose Valuta");
c = vdb.fetchValuteListView("0");
startManagingCursor(c);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1,
c,
new String[] {
ValuteDb.ValuteMetaData.VALUTE_NAME_KEY},
new int[] { android.R.id.text1});
stopManagingCursor(c);
lV.setAdapter(adapter);
miaAlert.setView(lV);
miaAlert.setCancelable(false);
lV.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
String riga = String.valueOf(id);
String confr = vdb.getRecord(riga,2);
System.out.println("position= " + position + "/id= " + id+"/nome= "+confr);
new_valuta = vdb.getRecord(riga,2);
listdb.update("9", "Valuta", new_valuta, "2");
c_list.requery();
return;
}
});
AlertDialog alert = miaAlert.create();
alert.show();}