title: How to set default value to listview
body: <p>I want to set a background to the default value in a list, Say the 1st list Item as default.</p>
  
  <p>I had set the property as setSlection(-1), but it doesn't work my list value does not show the item as selected.</p>
  
  <p>Please suggest.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Problem resolved :)</p>
  
  <p>Used the following code,</p>
  
  <pre><code>private void setListviewSelection(final ListView list, final int pos, final int notselectedpos1, final int notselectedpos2) {
      list.post(new Runnable() {
          @Override
          public void run() {
              list.setSelection(pos);
              View v = list.getChildAt(pos);
              View v1 = list.getChildAt(notselectedpos1);
              View v2 = list.getChildAt(notselectedpos2);
  
              if (v != null) {
                  v.setBackgroundResource(R.drawable.bg_select);
                  v1.setBackgroundResource(0);
                  v2.setBackgroundResource(0);
              }
          }
      });
  }
  </code></pre>
  
  <p>Find  this code from stack overflow itself but mistake closed the link that's why not able to provide the link sorry for that. :(</p>