Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Reactive Buttons

Hey there, working on an app and it has a set of buttons that I want to hold a certain color when pressed, but make it so that it if I press another it will go back to its original. I know it probably sounds easier with radio buttons, but I was looking at options and found one that uses java and another that uses xml. If you have any suggestions, I'd appreciate it.

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Sorry for the late reply - sounds like you'd need to tie into the onClickListener for each button and reset the others when a certain one is tapped. You could probably reuse the same onClickListener to make things a little easier.