开发者

Adding radio button of customize listview in radio group

I am currently working on customize listview in which i had extends array adapter and using getview method of it displayed each row with radio button on extreme right and item name on left side of each row now i want to put all radio button in radio group so that only one of it get selected at a time,but i am gettin exception as java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

here is basic code snippet which create this error.

class MyCustomAdapter extends ArrayAdapter and in getView()

if (row==null)  
{                                       
   row=inflater.inflate(R.layout.row, parent, false);

   RadioButton toggle1=(RadioButton)row.findViewById(com.example.ToggleButtonExample.R.id.toggle_id);
   //t开发者_C百科his is radio button which i had created in row.xml

   radio1.addView(toggle1); //create error here

 }


hi first you need to add radiobutton to radio group then to listview go through the link below it will help you.radiogroup issue

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜