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

Opening an intent for each input control(Extra Credit: Intents and Multiple Activities)

In the Extra Credit for Intents and Multiple Activities, it is asked to open a new activity for each input control. I would like a confirmation on the steps I have taken to achieve this.

I used the switch widget.

Steps:

  1. Set a listener for the switch widget using setOnCheckedChangeListener() method.

  2. Create and start a new activity in the listener when the switch is tapped.

I have checkbox, toggleButton and spinner widgets in addition to the switch. Are my steps correct and could I follow similar approach for other widgets also ?