Note that there are some explanatory texts on larger screens.

plurals
  1. POAlertDialog with SimpleAdapter and single choice mode does not show item clicked
    primarykey
    data
    text
    <p>I need to show an <code>AlertDialog</code> with a few custom rows. These rows should have a radio button on the right, and the choice mode should be single mode (hence radio buttons).</p> <p>What I have:</p> <pre><code>ArrayList&lt;HashMap&lt;String, String&gt;&gt; it = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); HashMap&lt;String, String&gt; map; map = new HashMap&lt;String, String&gt;(); map.put("asd", "test1"); it.add(map); map = new HashMap&lt;String, String&gt;(); map.put("asd", "test2"); it.add(map); map = new HashMap&lt;String, String&gt;(); map.put("asd", "test3"); it.add(map); SimpleAdapter sa = new SimpleAdapter(context, it, R.layout.dialog_row, new String[] { "asd" }, new int[] { android.R.id.text1 }); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setSingleChoiceItems(sa, -1, null); // here are added positive and negative buttons builder.show(); </code></pre> <p>xml for <code>dialog_row</code>:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;ImageView android:id="@+id/rowIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rh_3" /&gt; &lt;CheckedTextView android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="?listPreferredItemHeightSmall" android:checkMark="?android:attr/listChoiceIndicatorSingle" android:gravity="center_vertical" android:paddingLeft="?listPreferredItemPaddingLeft" android:paddingRight="?listPreferredItemPaddingRight" android:textAppearance="?textAppearanceListItemSmall" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>The <code>AlertDialog</code> shows up as I expect - but when I click an item, the radio button remains unchecked. Why is this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload