jeudi 22 décembre 2016

Getting Values Of Dynamically Created Checkboxes In Android

Based on the Database Values i was creating Text field , Radio button, Checkboxes..For checkboxes i don't know how to get selected checkbox Values for corresponding Question.

[user view page image !][1]

My Code is..

else if (cc.getString("q_type").equalsIgnoreCase("3")) {

                                b.setQno(j);
                                b.setQtype(3);
                                b.setQues(cc.getString("question"));
                                TextView t1 = new TextView(Main2Activity.this);
                                t1.setText(cc.getString("question"));

                                CheckBox[] cb = new CheckBox[2];

                                CheckBox c1 = new CheckBox(Main2Activity.this);
                                CheckBox c2 = new CheckBox(Main2Activity.this);
                                CheckBox c3 = new CheckBox(Main2Activity.this);



                                c1.setText(cc.getString("q_opt1"));

                                c2.setText(cc.getString("q_opt2"));

                                c3.setText(cc.getString("q_opt3"));

                                lView.addView(t1);
                                lView.addView(c1);
                                lView.addView(c2);
                                lView.addView(c3);

                                lView.setOrientation(LinearLayout.VERTICAL);
                                String qno =Integer.toString(j);
                                hm.put(qno, b);
                            }

Thanks in Advance.




Aucun commentaire:

Enregistrer un commentaire