title: Issues in Custom Gridview with Multiple Radiobutton with single selection in android
body: <p>I implemented a Gridview with radiobutton here is my code:</p>
  
  <p>row_layout.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:padding="5dp" &gt;
  
  &lt;ImageView
      android:id="@+id/imageView1"
      android:layout_width="50px"
      android:layout_height="50px"
      android:layout_marginRight="10px" &gt;
  &lt;/ImageView&gt;
  
  &lt;RadioButton
      android:id="@+id/radio"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" 
      android:focusable="false"
      android:focusableInTouchMode="false"/&gt;
  
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="5px"
      android:textSize="15px" &gt;
  &lt;/TextView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>My MainActivity.java File</strong></p>
  
  <pre><code>public class Radio extends Activity {
  
  ArrayList&lt;ParserCategory&gt;mList;
  DatabaseConnectionAPI mApi;
  ImageAdapter mAdapter;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      /*** Get Images from SDCard ***/
  
      // gridView1
      mApi=new DatabaseConnectionAPI(getApplicationContext());
      try {
          mApi.createDataBase();
            mApi.openDataBase();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      mList=mApi.getCategoryData();
      final GridView gView1 = (GridView)findViewById(R.id.gridView1); 
  
      mAdapter=new ImageAdapter(Radio.this, mList);
      gView1.setAdapter(mAdapter);
  
  
      // Get Item Checked
      Button btnGetItem = (Button) findViewById(R.id.btnGetItem);
      btnGetItem.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
              int count =  gView1.getChildCount();
  
              System.out.println("Count "+count);
              for (int i = 0; i &lt; count; i++) {
                  ViewGroup gridChild = (ViewGroup) gView1.getChildAt(i);
                  RadioButton rbtn = (RadioButton)gridChild.findViewById(R.id.radio);
                  if(rbtn.isChecked())
                  {
                      Log.d("Item "+String.valueOf(i), rbtn.getTag().toString());
                      System.out.println("ITEEMERM  "+String.valueOf(i)+rbtn.getTag().toString());
                      Toast.makeText(Radio.this,rbtn.getTag().toString() ,2000).show();  
                  }
              }  
          }
      });
  
  }
  
  
  public class ImageAdapter extends BaseAdapter 
  {
      private Context context;
      private ArrayList&lt;ParserCategory&gt; lis;
  
      public ImageAdapter(Context c, ArrayList&lt;ParserCategory&gt; mList) 
      {
          context = c;
          lis = mList;
      }
  
      public int getCount() {
          return lis.size();
      }
  
      public Object getItem(int position) {
          return position;
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
  
          LayoutInflater inflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
  
              if (convertView == null) {
                  convertView = inflater.inflate(R.layout.raddioshowimage, null);
              }
  
              TextView textView = (TextView) convertView.findViewById(R.id.textView1);
              String strPath = lis.get(position).toString();
  
              // Get File Name
              String fileName=lis.get(position).getCname();
              textView.setText(lis.get(position).getCname());
  
              ImageView imageView = (ImageView) convertView.findViewById(R.id.imageView1);
              RadioButton radiobtn = (RadioButton) convertView.findViewById(R.id.radio);
              radiobtn.setTag(fileName);
  
              return convertView;
  
      }
         } 
  
   }
  </code></pre>
  
  <p>When I run the above code it selects multiple items with radiobutton, but I want a single item selection when I click a button so any idea how can I solve it?</p>