1

I have Layout with ListView and in bottom there is EditText field where user can write down title and add new item in ListView. I the List item there is title but I want to add checkbox too. This is my code :

protected void addItemList() {
    // TODO Auto-generated method stub

    // TODO Auto-generated method stub
if (isInputValid(etInput)) {
    itemArrey.add(0,etInput.getText().toString());
    etInput.setText("");

    itemAdapter.notifyDataSetChanged();

}  

How can I add a checkbox?enter image description here

BenMorel
  • 34,448
  • 50
  • 182
  • 322
  • http://stackoverflow.com/questions/16685366/customised-listview-using-arrayadapter-class-in-android/16686623#16686623. check this might help – Raghunandan Jun 06 '13 at 12:52

1 Answers1

0

Create a custom adapter and add your views in the getView method (i.e., EditText and your Check boxes) So whenever you call your setadapter method it will get added to your view

Terril Thomas
  • 1,486
  • 13
  • 32
  • You mean like in here : http://stackoverflow.com/questions/10733601/add-custom-checkbox-to-listview –  Jun 06 '13 at 13:15
  • @BeginnerAndroid did you try the link i posted? – Raghunandan Jun 06 '13 at 13:21
  • the solution is nice but create the custom view like the user has questioned it. and do settag inside the convertview and then do after getTag.If u still didn't get it .just lemme know i'll share the code – Terril Thomas Jun 06 '13 at 13:23
  • 1
    @BeginnerAndroid yup thats why i posted a snap shot also – Raghunandan Jun 06 '13 at 13:36
  • 1
    @BeginnerAndroid i tested now on my device works fine. post your code. you might me doing it the wrong way – Raghunandan Jun 06 '13 at 13:40
  • @Raghunandan when i paste your code eclipse threw me that I need to import many things - I did it - but then I have to create new methods do I have to do it? –  Jun 06 '13 at 13:43
  • @BeginnerAndroid no need not create any methods – Raghunandan Jun 06 '13 at 13:46
  • 1
    let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/31334/discussion-between-raghunandan-and-beginnerandroid) – Raghunandan Jun 06 '13 at 13:47