title: ListView with Custom Layout including two RadioButtons
body: <p>I am tryin to make a quiz app with translations. So there are two ArrayLists with Question Loaded in differnt languages. </p>
  
  <p>I can show them in the List View as well. My problem is when I click on One Radiobutton I want the other Radiobutton to get selected as well. </p>
  
  <p>I am using a ListView with a custom layout with 2 Radiobuttons . </p>
  
  <p>This is my ArrayAdater for ListView</p>
  
  <pre><code>private class RBAdapterClass extends ArrayAdapter&lt;cOptions&gt; {
  
  private ArrayList&lt;cOptions&gt; fOptions;
  private ArrayList&lt;cOptions&gt; lOptions;
  private ArrayList&lt;Boolean&gt; mChecked;    
  private int mfSelectedPosition = -1;
  private RadioButton mfSelectedRB;   
  private int mlSelectedPosition = -1;
  private RadioButton mlSelectedRB;
  
  
  public RBAdapterClass(Context context, int textViewResourceId, ArrayList&lt;cOptions&gt; lOpt, ArrayList&lt;cOptions&gt; fOpt)
  {
      super(context,textViewResourceId,fOpt);     
      this.fOptions  =  new ArrayList&lt;cOptions&gt;();
      this.fOptions.addAll(fOpt);             
      this.lOptions =  new ArrayList&lt;cOptions&gt;();
      this.lOptions.addAll(lOpt);     
      mChecked = new ArrayList&lt;Boolean&gt;();
  }
      class ViewHolder {      
      TextView ForeignCode;
      RadioButton ForeignName;
      TextView LocalCode;
      RadioButton LocalName;
   }
  
  
  @Override
  public View getView(final int position, View convertView,  ViewGroup parent) {
  
    final  ViewHolder holderf ;               
    Log.v("Convert View",String.valueOf(position));
  
    if(convertView==null){
  
      LayoutInflater vi = (LayoutInflater)getSystemService(
      Context.LAYOUT_INFLATER_SERVICE);
      convertView = vi.inflate(R.layout.activity_activity_rb,null);
  
         holderf=new ViewHolder();           
  
         holderf.LocalCode = (TextView) convertView.findViewById(R.id.codeLocal);
         holderf.LocalName = (RadioButton)convertView.findViewById(R.id.radioBLocal);        
  
         holderf.ForeignCode = (TextView) convertView.findViewById(R.id.codeForeign);        
         holderf.ForeignName =  (RadioButton)convertView.findViewById(R.id.radioBForeign);
  
  
         convertView.setTag(holderf);
  
  
  
         holderf.ForeignName.setOnClickListener( new View.OnClickListener() {                                                               
  
             public void onClick(View v) {  
  
  
               RadioButton rb = (RadioButton) v ;   
  
               if(position != mfSelectedPosition &amp;&amp; mfSelectedRB!=null  )
               {
                   mfSelectedRB.setChecked(false);                     
                   if(mlSelectedRB!=null)
                   {
                   mlSelectedRB.setChecked(false);
                   } 
  
               }
  
               mfSelectedPosition = position;              
               mfSelectedRB = (RadioButton)v;             
  
  
  
               cOptions optSelected = (cOptions) rb.getTag();                  
  
               Toast.makeText(getApplicationContext(),"Clicked on RadioButton: " + rb.getText() +" is " + rb.isChecked(), 
               Toast.LENGTH_LONG).show();
  
               optSelected.setSeleted(rb.isChecked());  
  
  
               holderf.ForeignName.setChecked(rb.isChecked());                                
               holderf.LocalName.setChecked(rb.isChecked());
  
  
           }  
          });
  
  
         holderf.LocalName.setOnClickListener( new View.OnClickListener() {                      
  
             public void onClick(View v) {  
  
               if(position != mlSelectedPosition &amp;&amp; mlSelectedRB!=null)
               {
                   mlSelectedRB.setChecked(false);
                   if(mfSelectedRB!=null)
                   {
                   mfSelectedRB.setChecked(false);
                   }
               }                           
               mlSelectedPosition = position;              
               mlSelectedRB = (RadioButton)v;             
               RadioButton rb = (RadioButton) v ;                  
               cOptions optSelected = (cOptions) rb.getTag();  
               Toast.makeText(getApplicationContext(),
               "Clicked on RadioButton: " + rb.getText() +" is " + rb.isChecked(),Toast.LENGTH_LONG).show();
               optSelected.setSeleted(rb.isChecked());
               holderf.ForeignName.setChecked(rb.isChecked());
               holderf.LocalName.setChecked(rb.isChecked());
           }  
          }); 
  
  
         } 
  
    else 
  
    {
          holderf = (ViewHolder) convertView.getTag();
         }
  
         cOptions optfSelected = fOptions.get(position);
  
         cOptions optlSelected =  lOptions.get(position);
  
         if(mlSelectedPosition!=position)
         {
  
             holderf.ForeignCode.setText(" (" +  optfSelected.getsOptionsText() + ")");               
             holderf.ForeignName.setText(optfSelected.getsOptionsText());                        
             holderf.ForeignName.setChecked(optfSelected.getSeleted());                          
             holderf.ForeignName.setTag(optfSelected);               
  
  
             holderf.LocalCode.setText("("+optlSelected.getsOptionsText()+")");
             holderf.LocalName.setText(optlSelected.getsOptionsText());                          
             holderf.LocalName.setChecked(optlSelected.getSeleted());                        
             holderf.LocalName.setTag(optlSelected);             
  
         }
  
         else
         {
  
             holderf.ForeignCode.setText(" (" +  optfSelected.getsOptionsText() + ")");                                                      
             holderf.ForeignName.setText(optfSelected.getsOptionsText());           
             holderf.ForeignName.setChecked(optfSelected.getSeleted());
             holderf.ForeignName.setTag(optfSelected);
  
  
  
             holderf.LocalCode.setText("("+optlSelected.getsOptionsText()+")");
             holderf.LocalName.setText(optlSelected.getsOptionsText());                          
             holderf.LocalName.setChecked(optlSelected.getSeleted());                        
             holderf.LocalName.setTag(optlSelected);          
  
  
         }
  
  
  
      return convertView;
      }
   }
  </code></pre>
  
  <p>}</p>