Click listener on button in listitem

Put your problem here if it does not fit any of the other categories.

Click listener on button in listitem

Postby sachendra » Thu Aug 20, 2009 12:01 pm

Hey guys,
I am trying to implement a list with a button in every row. I used xml for list item. I can get button from xml , but when i click on button in listitem, it doesn'e call its callback method.

Please help its urgent
sachendra
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Mar 18, 2009 12:25 pm
Location: Mumbai

Top

Postby sachendra » Wed Sep 02, 2009 6:18 am

Not found any solution yet. Please help me. It means no one has faced this problem b4?
sachendra
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Mar 18, 2009 12:25 pm
Location: Mumbai

Postby pentace » Wed Sep 02, 2009 8:12 am

need alittle more info to be able to help you.
Are you using an activity or a list activity
also are you expanding a fully build list form xml or dynamically building it.
personally if i was going to be doing this i would,
create a list adapter to build my list and in the list adapter right after the code to add the button add an onclick handler right there.
others prefer to add it into the main activity. but whithout even seeing your code there is not much better of an answer i can give
pentace
Junior Developer
Junior Developer
 
Posts: 19
Joined: Wed Oct 22, 2008 2:16 pm

Postby sachendra » Tue Oct 06, 2009 8:31 am

I finally got it done.


You have to define click listener in Adapter's getView method. You can override this method.


pentace thanks for your support.
sachendra
Junior Developer
Junior Developer
 
Posts: 18
Joined: Wed Mar 18, 2009 12:25 pm
Location: Mumbai

Postby Maxood » Fri Dec 11, 2009 8:43 am

I am also looking for the same solution. I have an Array List populated with String values. What i need is to click on each item and get a new list on each item.
Maxood

"Life is an endless journey to achieve perfection"
Maxood
Developer
Developer
 
Posts: 34
Joined: Sun Aug 02, 2009 1:37 pm
Location: Karachi, Pakistan

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 20 guests