我遇到問題。在我的活動中,我有一個按鈕,當我點擊它時,我調用了一個方法。這個方法向我展示了一個帶有listview的警告對話框,並且我想將該項目單擊保存到一個變量中,然後我想關閉該方法但它不關閉!爲什麼??我發佈該方法的代碼。我的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();}
可能重複[方法不會關閉](http://stackoverflow.com/questions/10011500/method-doesnt-close) – Luksprog 2012-04-04 13:17:40
請不要張貼重複的問題。哦,我假設你想關閉對話框,而不是方法 – 2012-04-04 13:21:28