Note that there are some explanatory texts on larger screens.

plurals
  1. POReset row in listview Android
    text
    copied!<p>In ListView, when i selected row it is set background color with reset previous selected one. but when listview scoll down it shows other row selected same backgound means one bye one page scroll down the row is selected. </p> <p>Plz help me</p> <p>In this two images i selected only first row but when i scroll the page 23 row is already selected. How to set selected row with scrollable page?</p> <pre><code>ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setBackgroundResource(R.drawable.shape); // on seleting single voter // launching Edit Product Screen lv.setOnItemClickListener(new OnItemClickListener() { //mOnDoubleTapListener = listener; @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view,int position, long id) { boolean netFlag = new validationClass().haveNetworkConnection(context); if(!netFlag) { Toast.makeText(getApplicationContext(), "Data Connection is not available.", Toast.LENGTH_LONG).show(); return; } if (currentSelectedView != null &amp;&amp; currentSelectedView != view) { TextView textViewName = (TextView) currentSelectedView.findViewById(R.id.name); TextView textViewPart = (TextView) currentSelectedView.findViewById(R.id.partno); textViewName.setTextColor(getResources().getColor(android.R.color.darker_gray)); textViewPart.setTextColor(getResources().getColor(android.R.color.darker_gray)); } currentSelectedView =view TextView textViewName = (TextView) view.findViewById(R.id.name); TextView textViewPart = (TextView) view.findViewById(R.id.partno); textViewName.setTextColor(getResources().getColor(R.color.text_color)); textViewPart.setTextColor(getResources().getColor(R.color.text_color)); } </code></pre> <p>}</p> <p><img src="https://i.stack.imgur.com/1ppSd.jpg" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/ADrq7.jpg" alt="enter image description here"></p>
 

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