I have read the posts:
http://www.anddev.org/checkboxifiedtext ... -t695.html
http://www.anddev.org/checkbox_-_how_to ... -t739.html
I have done a list of checkbox and it works, but I don't like how it works. I'm going to explain what it does:
I want to know what checkboxes are selected, so I give to the checkboxes one identifier in getView() method. Also in this method I have an ArrayList where I save the checkboxes with their identifier. The problem is that if I have created 3 checkboxes, the getView() method runs 6 times, so the application duplicate the id of the checkboxes, for example:
I create the next checboxes: checkbox1, checkbox2, checkbox3
The ArrayList of checkboxes has: (0,checkbox1),(1,checkbox2),(3,checkbox2),(4,checkbox1),(5,checkbox2),(6,checkbox3)
Why the getView() method runs more times?
In the code of bluefloyd8 also the getView method runs more times.
Is other way to do this?
The checkboxes ArrayList I use in the ListActivity when I choose a menu option to know what checkbox is checked:
Using java Syntax Highlighting
- for(int i=0; i<thecheckboxes.size();i++){
- if(thecheckboxes.get(i).isChecked()){
- ........
- }
- }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
I have one adapter where I do the getView() method like this:
Using java Syntax Highlighting
- public View getView(int position, View convertView, ViewGroup parent) {
- // TODO Auto-generated method stub
- Element p = listE.get(position);
- return generarFila(p.getElement());
- }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
In generarFila() method I give one id to the checkboxes:






