I have added 9
CheckBox
in myFragment
which is getting checked according to the response from JSON. If user wants to update his/her profile, He/she cancheck/uncheck
any of them. Now I have to confirm that how many of them arechecked
and create anArray
as aparameter
according to that. I am not using anyadapter
for that. please let know how to set the condition to get the value of only checked checkboxes
I am trying to do like this
cb_prfl_setng_general=(CheckBox)rootView.findViewById(R.id.cb_prfl_setng_general);
cb_prfl_setng_economics = (CheckBox)rootView.findViewById(R.id.cb_prfl_setng_economics);
cb_prfl_setng_business=(CheckBox)rootView.findViewById(R.id.cb_prfl_setng_business);
cb_prfl_setng_social=(CheckBox)rootView.findViewById(R.id.cb_prfl_setng_social);
cb_prfl_setng_politics=(CheckBox)rootView.findViewById(R.id.cb_prfl_setng_politics);
cb_prfl_setng_entertainmnt=(CheckBox)rootView.findViewById(R.id.cb_prfl_setng_entertainmnt);
cb_prfl_setng_technology=(CheckBox)rootView.findViewById(R.id.cb_prfl_setng_technology);
cb_prfl_setng_spritual=(CheckBox)rootView.findViewById(R.id.cb_prfl_setng_spritual);
cb_prfl_setng_sports=(CheckBox)rootView.findViewById(R.id.cb_prfl_setng_sports);
if(cb_prfl_setng_general.isChecked()){
String[] Interest = {"catagory_id=1"};
}else if(cb_prfl_setng_economics.isChecked()){
String[] Interest = {"catagory_id=1","catagory_id=2"};
}else if(cb_prfl_setng_general.isChecked()){
String[] Interest = {"catagory_id=1","catagory_id=2","catagory_id=3"};
}else if(cb_prfl_setng_entertainmnt.isChecked()){
String[] Interest = {"catagory_id=1","catagory_id=2","catagory_id=3","catagory_id=4"};
}
But I don't think this is the right way to get the exact value.
Aucun commentaire:
Enregistrer un commentaire