0
Ich habe ein Problem. In meiner Aktivität habe ich eine Schaltfläche und wenn ich darauf klicke rufe ich eine Methode auf. Diese Methode zeigt mir einen Alarmdialog mit einer Listenansicht und ich möchte das Element speichern klicken Sie auf eine Variable und dann möchte ich die Methode schließen, aber es schließt nicht !!! warum? Ich poste den Code der Methode. Mein Logcat gibt mir keinen Fehler. Kann mir jemand helfen ?? bitteMethode schließt nicht
private void getValuta() {
// AlertDialog creation
AlertDialog.Builder miaAlert = new AlertDialog.Builder(this);
final ListView lV = new ListView(this);
Cursor c = null;
// Set the title of the dialogBox
miaAlert.setTitle("Choose Valuta");
// I call the Query
c = vdb.fetchValuteListView("0");
// handle of the cursor
startManagingCursor(c);
// I create the SimpleCursorAdapter
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, // Context
android.R.layout.simple_list_item_1, // row/product layout
c, // the cursor
new String[] {
ValuteDb.ValuteMetaData.VALUTE_NAME_KEY},
// the colums
new int[] { android.R.id.text1});// views
stopManagingCursor(c);
// The listView is filled using the adapter created above
lV.setAdapter(adapter);
miaAlert.setView(lV);
miaAlert.setCancelable(false);
// list view listener
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;
}
});
// I create the AlertDialog
AlertDialog alert = miaAlert.create();
// I showw the AlertDialog
alert.show();
Vielleicht möchten Sie Ihre Kommentare, Strings und Methoden ins Englische übersetzen, um eine bessere/mehr Antworten zu bekommen. –