Qestion on ListView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Qestion on ListView

Postby llawcy » Thu Jan 07, 2010 9:38 am

Hi, I account for a question.

My layout is that: one ListView, each item incudes two textviews and one button.

when I add setOnItemClickListener for each items and setOnClickListener for the button, but the setOnItemClickListener is shielded by the button's ClickListener. So, how can I make these two listeners to work normally?

Thanks a lot!

Emal: larry.ljp@163.com
llawcy
Freshman
Freshman
 
Posts: 4
Joined: Thu Jan 07, 2010 9:26 am

Top

Postby jwei512 » Thu Jan 07, 2010 11:01 pm

How are you adding the Button's onClickListener? Could you post your code?

I'm pretty sure I've done this before and I used a custom simplecursoradapter to do this, but I'm interested to see how you're handling it and why it's not working for you.
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Postby llawcy » Fri Jan 08, 2010 1:51 am

hi, jwei
I didnot add the OnClickListener of the button now, I add one button on each item in the ListView, the OnItemClickListener doesnot work.

So I hope that I can click one item to view the detail of it and press the button to excecute some operations. Do you have some advices to me?
Thanks a lot!
llawcy
Freshman
Freshman
 
Posts: 4
Joined: Thu Jan 07, 2010 9:26 am

Postby jwei512 » Fri Jan 08, 2010 2:25 am

Hey llawcy,

Could you post your code? (JAVA and XML)

Are you using a custom adapter?
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Postby llawcy » Fri Jan 08, 2010 2:37 am

thanks for your replay

I use SimpleCursorAdapter as the adapter. I could not post the codes, maybe the reason of my net.
llawcy
Freshman
Freshman
 
Posts: 4
Joined: Thu Jan 07, 2010 9:26 am

Postby jwei512 » Fri Jan 08, 2010 7:07 am

I'm pretty sure you need to use a custom cursor adapter. If you can't figure it out soon, I'll try it out myself and I'll write a blog on it or something.
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 9 guests