Android - Custom ListView with a checkbox and a spinner?

Ok, I solved it, but I think there's a better way! Here's what I did: 1) I defined a global HashMap : private HashMap spinnerMap = new HashMap() 2) In the ViewBinder (when the Spinner is considered) I retrive each Spinner s number (it's stored in info. Get(0)), and I link it with the spinner, using the HashMap : spinnerMap.

Put(String. Format("spinner %d", info. Get(0)), spinner) 3) In the ViewBinder (when the CheckBox is considered) I set the enableSpinner(Spinner spinner, boolean b) function as the onClickListener of the CheckBox : } else if(data instanceof String && view instanceof CheckBox) { final CheckBox box = (CheckBox) view; final String numero = (String) data; box.

SetOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (box.isChecked()) { enableSpinner( (Spinner)spinnerMap. Get(String. Format("spinner %d", Integer.

ParseInt(numero))), true); } else { enableSpinner( (Spinner)spinnerMap. Get(String. Format("spinner %d", Integer.

ParseInt(numero))), false); } } }); return true; } 4) Finally, here's the function: private void enableSpinner(Spinner spinner, boolean b) { spinner. SetEnabled(b); } This does the job... but do you know a better way? Thanks!

Ok, I solved it, but I think there's a better way! Here's what I did: 1) I defined a global HashMap: private HashMap spinnerMap = new HashMap(); 2) In the ViewBinder (when the Spinner is considered) I retrive each Spinner's number (it's stored in info. Get(0)), and I link it with the spinner, using the HashMap: spinnerMap.

Put(String. Format("spinner %d", info. Get(0)), spinner); 3) In the ViewBinder (when the CheckBox is considered) I set the enableSpinner(Spinner spinner, boolean b) function as the onClickListener of the CheckBox : } else if(data instanceof String && view instanceof CheckBox) { final CheckBox box = (CheckBox) view; final String numero = (String) data; box.

SetOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (box.isChecked()) { enableSpinner( (Spinner)spinnerMap. Get(String. Format("spinner %d", Integer.

ParseInt(numero))), true); } else { enableSpinner( (Spinner)spinnerMap. Get(String. Format("spinner %d", Integer.

ParseInt(numero))), false); } } }); return true; } 4) Finally, here's the function: private void enableSpinner(Spinner spinner, boolean b) { spinner. SetEnabled(b); } This does the job... but do you know a better way? Thanks!

2) The Spinner is active and selectable of and only if the correlated CheckBox is checked. I've managed to achieve (1) using a SimpleAdapter and a ViewBinder. The problem is that I don't know how to find the right Spinner from the "enable spinner" function.

What is the best way to achieve this?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send