Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to cancel Android ListView item from being activated/highlighted in ListView's setOnItemClickListener?
    primarykey
    data
    text
    <p>In one of my Activities, I have multiple <strong>ListView</strong> controls. Say <strong>List 1</strong>, <strong>List 2</strong> &amp; <strong>List 3</strong>. On <strong>List 1</strong> item's click, i load data for <strong>List 2</strong> &amp; <strong>List 3</strong> from a webservice. And the clicked item's background is highlighted. I achieved this through following selector.</p> <pre><code>&lt;item android:drawable="@drawable/item_pressed" android:state_pressed="true"/&gt; &lt;item android:drawable="@drawable/item_focused" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/&gt; &lt;item android:state_activated="true" android:drawable="@drawable/item_selected"/&gt; </code></pre> <p>As you can see, i have specified the <strong>android:state_activated="true"</strong> to change the BG of the clicked/tapped item. This works well.</p> <p>Actually i want to prevent the clicked item from being selected/highlighted if data for some other item is being loaded ... like</p> <pre><code>list1.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // load data if no other call to web service is in progress if (_isNotLoadingData) { loadList2AndList3DataUsingWebService(); } else { //Stop This Item From selected/highlighted //BUT none of the following work. .. Item is always Selected view.setSelected(false); //view.setActivated(false); //view.setEnabled(false); } } }); </code></pre> <p>Above code stops multiple calls to be directed to our web service but i am unable to stop the item from being highlighted/activated if the web service is not called for that ListView item.</p> <p>How can i acieve this?</p> <p><strong>EDIT on 8:08 pm 19 Mar, 2012:</strong> No proper reply yet ... i am stuck &amp; waiting for any help</p>
    singulars
    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.
 

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