Gosh, I finally figured it out.

On Saturday, June 04, 2011 01:16:32 PM Kent Loobey wrote:
> Has anyone got this dialog to work?
> 
> How does one get the selected checkbox to reflect the change when clicked?
> 
> =========================================
> String myList = ROW_ID + "," + ITM_DESC + "," + ITM_CHECKED;
> final Cursor myCursor =
>    myDB.rawQuery(
>         "SELECT " + myList + " FROM " + myTable + " ORDER BY " + ITM_DESC
>        + " ASC", null);
> 
> final AlertDialog alertDialog = new AlertDialog.Builder(this);
> alertDialog.setMultiChoiceItems(myCursor, ITM_CHECKED, ITM_DESC,
>     new DialogInterface.OnMultiChoiceClickListener() {
>         @Override
>         public void onClick(
>            final DialogInterface dialog, int which, boolean isChecked) {
>               if (cursor.moveToNext()) {
>                 long rowId = cursor.getLong(cursor.getColumnIndex(ROW_ID));
> 
> // I would think that rowId would be the correct _id but it is not.
> // "which" is the right line number but how to get the correct _id?
> // And they there is the issue of how to get the check box checked...
> // Since we must have a column in the database for the check box
> // state I would think that everything would be taken care of by the
> // AlertDialog code and that after a return from the dialog all I would
> // need to do is query the database for checks in the check box column.
> 
>               }
>            }
>        );
>    }
> ... set other stuff ...
> alertDialog.create();
> =========================================
> 
> Frankly I have spent way too much time on this problem.  I have searched
> high and low on the Internet and I can't find anyone that has gotten this
> to work.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to