mercredi 27 mai 2015

check all dynamically created checkbox at button click

I need to check all the checkbox which is dynamically created at button click.

This is my code:

layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                        final View addView = layoutInflater.inflate(R.layout.row, null);
                        final Button  ItemName, Item_Qty, Amount, Total, btn_home_checkbox1, btn_home_uncheckbox1;
                      //  final Button slNo;
                        final CheckBox cb_select_Item,cb_unselect_Item;
                        final RelativeLayout checkbox_bg, uncheckbox_bg;
                        slNo = (Button) addView.findViewById(R.id.order_btn_slNo1);
                        ItemName = (Button) addView.findViewById(R.id.order_btn_ItemName1);
                        Item_Qty = (Button) addView.findViewById(R.id.order_btn_Qty1);
                        Amount = (Button) addView.findViewById(R.id.order_btn_amount1);
                        Total = (Button) addView.findViewById(R.id.order_btn_total1);
                        checkbox_bg = (RelativeLayout) addView.findViewById(R.id.order_rl_checkBox1);
                        uncheckbox_bg = (RelativeLayout) addView.findViewById(R.id.order_rl_uncheckBox1);
                        cb_select_Item = (CheckBox) addView.findViewById(R.id.home_checkbox1);
                        cb_unselect_Item = (CheckBox) addView.findViewById(R.id.home_uncheckbox1);

 container.addView(addView);

Any suggestions?




Aucun commentaire:

Enregistrer un commentaire