1

I am working on an android application that I like to do something like this picture below to a listview:

as you can see, there's a custom adapter for a list view that generates a list out of one of my classes. I want to add a view like a Linearlayout or something under a Listview item after I clicked it. how can I do that? PS: where I have to put an onItemClickListener()? in my adapter's class or in my main page after onCreate() method? PPS: in the picture, I meant SUBITEM FOR ITEM1... sorry...

Community
  • 1
  • 1
Bardya Momeni
  • 53
  • 1
  • 8

1 Answers1

0

You essentially want to do what this person does with a ViewStub, and implement an OnClickListener that is attached to each ListItem.

Please let me know if that is not clear or if you can't find a good example, and I'll see what I can do. :)

Community
  • 1
  • 1
Codeman
  • 12,157
  • 10
  • 53
  • 91
  • okay I managed to use ViewStub, and managed to inflate it on an listview's itemclick. but when I click an item for the second time, the app crashes, I know why it crashesh because there is no viewstub remained in there it was inflated. how can I check if a viewstub is inflated so I won't get to an exception? and how can I deflate it? thanks... – Bardya Momeni Sep 19 '12 at 12:32
  • and I coded the onclicklistener into the getView method in my adapter... is that right? – Bardya Momeni Sep 19 '12 at 12:33