1. Are you ready for the Galaxy S20? Here is everything we know so far!

Android: Several Radio button in custom list view

Discussion in 'Android Development' started by Corssis, Oct 11, 2014.

  1. Corssis

    Corssis Lurker
    Thread Starter

    please check code

    Problem : when click radio button Question one All questions are clicked on

    package com.radiobutton.listview; import java.util.ArrayList; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; public class Adaptersoal extends ArrayAdapter<Structsoal>{ public Adaptersoal(ArrayList<Structsoal> array) { super(G.context, R.layout.adapter_soal,array); } public static class ViewHolder { public TextView txt_soal; public ViewGroup btn_soal; public RadioButton gozine1; public RadioButton gozine2; public RadioButton gozine3; public RadioButton gozine4; public RadioGroup rdb_go; public ViewHolder (View view) { txt_soal = (TextView) view.findViewById (R.id.txt_soal); txt_soal.setTypeface(G.tf); txt_soal.setTextSize(18); gozine1 = (RadioButton) view.findViewById(R.id.gozine1); gozine2 = (RadioButton) view.findViewById(R.id.gozine2); gozine3 = (RadioButton) view.findViewById(R.id.gozine3); gozine4 = (RadioButton) view.findViewById(R.id.gozine4); rdb_go = (RadioGroup) view.findViewById(R.id.rdb_g); btn_soal = (ViewGroup) view.findViewById(R.id.btn_soal); } public void fill(ArrayAdapter<Structsoal> adapter, final Structsoal itemsoal,int position) { txt_soal.setText(itemsoal.s_soal); gozine1.setText(itemsoal.s_gozine1); gozine2.setText(itemsoal.s_gozine2); gozine3.setText(itemsoal.s_gozine3); gozine4.setText(itemsoal.s_gozine4); } } @Override public View getView(int position, View convertViewsoal, ViewGroup parent) { ViewHolder holder; Structsoal itemsoal = getItem(position); if(convertViewsoal==null) { convertViewsoal = G.inflater.inflate(R.layout.adapter_soal,parent,false); holder = new ViewHolder(convertViewsoal); convertViewsoal.setTag(holder); }else { holder = (ViewHolder) convertViewsoal.getTag(); } holder.fill(this, itemsoal, position); return convertViewsoal; } }
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Android Several Radio
  1. Scadica
    Replies:
    0
    Views:
    122
  2. SrLimon
    Replies:
    0
    Views:
    135
  3. Olive
    Replies:
    2
    Views:
    145
  4. charlington
    Replies:
    5
    Views:
    223
  5. whois1230
    Replies:
    4
    Views:
    237
  6. Jason Edwardes
    Replies:
    0
    Views:
    138
  7. _nobody_
    Replies:
    1
    Views:
    225
  8. Azhar Alhindi
    Replies:
    5
    Views:
    523
  9. Hada de la Luna
    Replies:
    1
    Views:
    1,038
  10. N4ty_Kitty
    Replies:
    4
    Views:
    1,349

Share This Page

Loading...