title: Android listview item background change
body: <p>i have a android listview. i want to change listview item background when i click one listview item.</p>
  
  <p>and then previous selected item must go back to default background. this means only one item has to be selected. </p>
  
  <p>i have searched it for a long time. i can change background of selected item using onItemClick()</p>
  
  <p>but i can't change previous selected item. for example, if i select second item, it was changed. and then i select third item. oh my god! it is changed too!  what can i do for this. how can i get the previous position?</p>
  
  <p>here is my android code.</p>
  
  <pre><code>private class ListViewItemClickListener implements
              AdapterView.OnItemClickListener {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,
                  long id) {
  
              TextView title = (TextView) view.findViewById(R.id.title);
              title.setBackgroundResource(R.drawable.list_shape);
  
          }
      }
  </code></pre>