I am showing a checkbox dialog (a list retrieved from the database) to allow the user to choose which rows to delete. Since caching is in the Android dialog, I need to update the count and flag names. In my onCreateDialog:
dialog = new AlertDialog.Builder( this ) .setTitle( "Remove Items" ) .setMultiChoiceItems( items, _selections, new OnMultiChoiceClickListener(){public void onClick (DialogInterface dialog, int which, boolean isChecked){}} ) .setPositiveButton("Smazat", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); deleteRow(_selections); } }) .setNegativeButton("Storno", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }) .create();
How to update values ββ(items, _selections) in onPrepareDialog? I tried to invalidate the views, hoping that force android would load the items into the againe (none work), but I think this is a bad choice, as well as deleting the dialog and re-creating.
protected void onPrepareDialog(final int id, final Dialog dialog) { switch (id) { case REMOVE_DIALOG_ID: ListView lv = ((AlertDialog) dialog).getListView(); lv.invalidateViews(); break; }
Thanks for any ideas!
Hruskozrout
source share