title: Only select only one radio button from listview
body: <p>I have searched the question over and over, there are many questions I have found in stackoverflow but I did not come up with a solution. Here is my problem. 
  I have a list of item in a linearlayout like this: 
   <img src="https://i.stack.imgur.com/iFml0.jpg" alt="enter image description here"></p>
  
  <p>When the screen comes first, the last radion button is selected automatically. But if I select another radio button, the last radio button is already in selected state. I want to select only one radion button but at the same time when the screen comes first the last radio button will be auto selected and other automatically will not be selected. 
  How can I achieve this.
  My adapter class is : </p>
  
  <pre><code>public class AdapterPaymentMethod extends ArrayAdapter&lt;PaymentData&gt; {
      private Context context;
      private boolean userSelected = false;
      ViewHolder holder;
  
      public AdapterPaymentMethod(Context context, int resource,
              List&lt;PaymentData&gt; items) {
          super(context, resource, items);
          this.context = context;
      }
  
      /* private view holder class */
      private class ViewHolder {
          RadioButton radioBtn;
          Button btPaymentMethod;
          // ImageView ivLine;
      }
  
      public View getView(final int position, View convertView, ViewGroup parent) {
          holder = null;
          PaymentData rowItem = getItem(position);
          LayoutInflater mInflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          if (convertView == null) {
              convertView = mInflater.inflate(
                      com.android.paypal.homeactivity.R.layout.list_item, null);
              holder = new ViewHolder();
              holder.radioBtn = (RadioButton) convertView
                      .findViewById(com.android.paypal.homeactivity.R.id.rdb_payment_method);
              holder.btPaymentMethod = (Button) convertView
                      .findViewById(com.android.paypal.homeactivity.R.id.bt_item_event);
              convertView.setTag(holder);
          } else
              holder = (ViewHolder) convertView.getTag();
  
          if(position==getCount()-1 &amp;&amp; userSelected==false){
              holder.radioBtn.setChecked(true);
          Log.d("if position", ""+position);
          }
          else{
              holder.radioBtn.setChecked(false);
              Log.d("else position", ""+position);
          }
  
          holder.radioBtn.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  userSelected=true;
                  if(getCount()-1==position&amp;&amp;userSelected==true){         
                  }
                  else if(getCount()-2==position&amp;&amp;userSelected==true)
                  {
                      holder.radioBtn.setChecked(true);
                  }
              }
          });
  
  
  
          holder.radioBtn.setText(rowItem.getRdbText());
          holder.btPaymentMethod.setText(rowItem.getBtText());
          return convertView;
      }
  }
  </code></pre>