checkbox - Ui updating twice in listview in android -
I'm developing an Android application. In this I have a list view with checkboxes for each item.
By default all items are checked. I've clicked on the checklist for the checklist. Whenever the user clicks on the check box, I am setting the changing price in the current situation.
Everything is fine. But U is updated for two alternative items instead of one. For example, if I click on the second check box, the fourth check box is also being updated in the user interface. Click the address for the listener only has a call time
down on the listener, click Adapter class. View public view getView (last integer status, see convertView, ViewGroup parent) {layout infographic implant = (layout inflator) mcontext .getSystemService (reference. LAOUT_INFLATER_SERVICE); See viewview = Convertview; Listview = inflater.inflate (R.litt.edit_graph_user_item, empty); // Get all the areas of layout; YouTube = (TextView) listview.findViewById (R.id.code); Checkbox = (checkbox) listview.findViewById (R.id.checkBox1); UserTV.setText (userList.get (status) .getUserName ()); Checkbox.setChecked (true); checkbox.setOnClickListener (New OnClickListener () {@Override public void onClick (View v) {is Log.v ( "status:" "," + position); the Log.v ( "Befoer checkbox status:" "," + GroupsAdapter.group_users.get (status) .isSelected ()); if set (to! GroupsAdapter.group_users.get (status) .isSelected ()) {// User Bean GroupsAdapter.group_users.get (status) to correct Ksetset selected (true); checkbox Ksetsakd (true);} else {// set, incorrect values in user Bean groups Krenadattrjip_jrskget (position) Ksetset selected (false); Czech Oks Kset Czech (false);}}}); Return list view; } I do not know what was wrong. Can you tell me how to solve this issue above?
This is, each item you need to set the default value, you make with the following Need to change the code: Tell me the result.
see public getView (final integer status, seeviewview, viewgroup parent) {layoutInfleter inflator = (layoutInflator) mcontext .getSystemService (context.LAYOUT_INFLATER_SERVICE); See viewview = Convertview; Listview = inflater.inflate (R.litt.edit_graph_user_item, empty); // Get all the areas of layout; YouTube = (TextView) listview.findViewById (R.id.code); Checkbox = (checkbox) listview.findViewById (R.id.checkBox1); UserTV.setText (userList.get (status) .getUserName ()); // This line checkbox changed .settags (status); Checkbox.setChecked (GroupsAdapter.group_users.get (status) .isSelected ()); // *********** checkbox.setOnClickListener (New OnClickListener () {@Override see public void onClick (v) {Czech box ch = (Czech box) V; the // to get poition for this line clicked add int position = (int) VkgetTag (); Logkv ( "status:" "," + position); the Log.v ( "Befoer checkbox status:" "," + GroupsAdapter.group_users.get (Pos) .Secondated ()!; If (! GroupDriverGeP_Games.Tate (POG) .This selected () group GroupAgroup_UserGet (Pause) .Set selected (true); Other group adapter. Group_gers.jet (pause) .cat false); Activity.adaptivedatasettags (); // adapter is your adapter that you changed to venerate // stabilize the public and refresh your list here}}); Return list view; }
Comments
Post a Comment