Note that there are some explanatory texts on larger screens.

plurals
  1. POListView not checking items on Android 1.5
    primarykey
    data
    text
    <p>I'm developing an app for Android in Eclipse. Currently I target API level 3, but I was mistakenly testing on an Android 1.6 emulator (API level 4). On 1.6 it worked fine, but on 1.5 my ListView with CHOICE_MODE_SINGLE does not select items when they are clicked on. </p> <p>Here's my listview XML:</p> <pre><code>&lt;ListView android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_weight="1" android:id="@+id/ListDomains" android:layout_margin="5px" android:choiceMode="singleChoice" android:clickable="false" android:focusable="true" android:focusableInTouchMode="true" android:descendantFocusability="beforeDescendants" &gt; &lt;/ListView&gt; </code></pre> <p>Here's the XML for the items in the listview:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:id="@+id/domain_list_value" android:checkMark="?android:attr/listChoiceIndicatorSingle" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="fill_parent" &gt; &lt;/CheckedTextView&gt; </code></pre> <p>I created a custom ArrayList adapter to let me customize getView. Here's the code for DomainArrayAdapter:</p> <pre><code>public class DomainArrayAdapter extends ArrayAdapter&lt;char[]&gt; { private LayoutInflater mInflater; public DomainArrayAdapter(Context context, int textViewResourceId, List&lt;char[]&gt; objects) { super(context, textViewResourceId, objects); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null){ convertView = mInflater.inflate(R.layout.domain_list, null); } char[] text = super.getItem(position); ((CheckedTextView)convertView).setText(text, 0, text.length); return convertView; } } </code></pre> <p>All of this code works fine compiled against API level 3 and run on an Android 1.6 emulator. However, run against a 1.5 emulator, items in the ListView do not check when clicked on.</p> <p>Any ideas?</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