Note that there are some explanatory texts on larger screens.

plurals
  1. PORadiobutton in Customized listview-- one time only one should be selected
    primarykey
    data
    text
    <p>I am stuck in a situation where I need to get the ID of checked Radiobutton. I know where the problem is but I can not solve it so Please suggest me on base of my code.</p> <pre><code>@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder=null; bean=arrayListCountry.get(position); LayoutInflater inflater=(LayoutInflater)context.getSystemService(Service.LAYOUT_INFLATER_SERVICE); if(convertView==null) { convertView=inflater.inflate(R.layout.custom_layout_listview, null); holder=new ViewHolder(); holder.textCountryName=(TextView)convertView.findViewById(R.id.textView1); holder.radioCountry=(RadioButton)convertView.findViewById(R.id.radioButton1); RelativeLayout relativeLayout=(RelativeLayout)convertView.findViewById(R.id.relativeCustomLayout); relativeLayout.addView(convertView); convertView.setTag(holder); convertView.setTag(R.id.textView1,holder.textCountryName); } else holder=(ViewHolder)convertView.getTag(); holder.radioCountry.setTag(position); holder.textCountryName.setText(bean.getCountryName()); holder.radioCountry.setChecked(bean.getIsSelected()); holder.radioCountry.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub int pos=(Integer)buttonView.getTag(); Country_Bean country_Bean=arrayListCountry.get(pos); coubean.setIsSelected(buttonView.isChecked()); //buttonView.setChecked(bean.getIsSelected()); Toast.makeText(context, "POs:"+pos+"\ncountry:"+bean.getCountryName()+"\ncountry_check:"+bean.getIsSelected()+"\nbuttonCheck:"+buttonView.isChecked(), Toast.LENGTH_SHORT).show(); } }); return convertView; } </code></pre> <p>Please tell me how can I get the specific radiobutton. I also want to know why getView normally used and how can we manually call that method. Thank you in advanced.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload