0

I am using a dynamic ListView which contains 3 buttons ,1 checkbox and a textview.I want that 1.) The user should be able to check only one checkbox from any row, if one is checked so other row's checkbox should be unchecked . 2.) text on button & textView is also generated dynamically via different ArrayLists so how can I use diff-2 arraylist in a single ListView.

3
  • When you try with a single arraylist does it work? Commented May 2, 2011 at 11:39
  • @Hades works with single arraylist but checkbox's problem is still there Commented May 4, 2011 at 5:04
  • Use a hashmap to maintain what has been already clicked, if it is clicked then set the checkbox to ticked, if it's not then untick it. You have to do this in the getview method in the listview. Commented May 4, 2011 at 5:09

2 Answers 2

1

Craete a class E(You can rename as you want) like this

import java.util.ArrayList; 

public class E {   

private ArrayList<Object> list1;
private ArrayList<Object> list2;
/**
 * @param list1 the list1 to set
 */
public void setList1(ArrayList<Object> list1) {
    this.list1 = list1;
}
/**
 * @return the list1
 */
public ArrayList<Object> getList1() {
    return list1;
}
/**
 * @param list2 the list2 to set
 */
public void setList2(ArrayList<Object> list2) {
    this.list2 = list2;
}
/**
 * @return the list2
 */
public ArrayList<Object> getList2() {
    return list2;
}
}

Now here is your ArrayList which uses multiple ArrayList

    ArrayList<E> custom=new ArrayList<E>();

Hope this will help you.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply but I solved my second problem my own. Still one to go
Then post your solution for other people's help.
0

Merge the two ArrayLists into a single ArrayList and set it as the adapter.

1 Comment

but the problem is this I have to use different-2 ArrayList for different Views say 1 for textview 2 for button1 3 for button2 n so on. Plz Help me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.