android - Delete checkbox and button from the LinearLayout -


i creating checkbox list button programmatically. updating purpose need delete old checkbox list , button before creating new 1 in delete_element method. how can delete checkbox , button linearlayout?

i appreciate help.

    private void createcheckboxlist(final arraylist<integer> items) {         final arraylist<integer> selected = new arraylist<integer>();          final linearlayout ll = (linearlayout) findviewbyid(r.id.lila);         (int = 0; < items.size(); i++) {             checkbox cb = new checkbox(this);             cb.settext(string.valueof(items.get(i)));             cb.setid(items.get(i));             ll.addview(cb);          }         button btn = new button(this);         btn.setlayoutparams(new linearlayout.layoutparams(500, 150));         btn.settext("submit");         ll.addview(btn);          btn.setonclicklistener(new view.onclicklistener() {}  } 

i think need rethink design, need go adapter approach. listview created child elements populated adapter holds values of child elements. selected or particular position child item can added or deleted or modified or saved.

have @ link adapter listview example: http://www.javacodegeeks.com/2013/09/android-listview-with-adapter-example.html


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -