xtensivearts - One Leap Ahead
Episode #5 – Using Radio Buttons

Episode #5 – Using Radio Buttons

Posted 08/02/2009 - 12:16 am by Mathias Reisch

In this episode we will take a look at radio buttons and how to use them to create a simple color-switching application. Additionally you will learn more layout related stuff, which is always a good thing.

The Tutorial

If you enjoyed this episode. please don’t forget to share it on your favorite social platform. Also, if you like, you can follow this tutorial series on Twitter.

You can download the project files for this episode here: Episode #5 Project Files (.zip)

Related posts:
  1. Episode #4 – Checkboxes & Complex Layouts
  2. Episode #3 – Using Buttons
  3. Episode #6 – Notification & Long Clicks
  4. Episode #11 – Intents: Multi Activity Applications
  5. Episode #10 – Intents: An Introduction
  6. Episode #7 – Using Basic Lists
  7. Episode #2 – Create A New Project And Run It
  8. Episode #8 – The Alert Dialog
  9. Episode #9 – Lists: Item Clicks
  10. Episode #1 – Getting Started!

Why Not Leave a Comment?

Name:*
E-Mail:*
Website:
Comment:*

Comments

Amaru

02/13/2010 – 1:18 am

Tnx Mathias! ^_____^
Keep up the good work.

Chris

02/22/2010 – 11:36 am

Great tutorials Mathias. Very well explained. Thank you.

Ambrose

03/11/2010 – 9:40 am

That helped me a lot, thank you so much!

Julian Porras

05/26/2010 – 5:38 am

Thanks Mathias.. I really appreciate your work it has been very useful for me.. It is different to read than to see and understand the concepts in the practice.. i hope you continue.. Best Regards

hannes

05/27/2010 – 9:34 pm

maybe you can show later on how you put the colors in a colors.xml file

Stefan

09/14/2010 – 8:20 am

Tnx Tnx Tnx Tnx 100 times 10x I need this from start up just to see the framework and how it’s done :) keep up the good work!!! Regards from Macedonia

Gavin

10/29/2010 – 10:34 am

This is the best tutorial I have come across on the internet – it takes you step by step through the basics. This has given me exactly what I needed to progress with coding Android applications.
“I doff my hat good sir”

Sebastian

11/01/2010 – 11:13 am

Nice work keep it up!

Stefan

11/03/2010 – 4:20 am

Very nice series of tutorials so far, Mathias!

You are a natural instructor :)

Alex

11/10/2010 – 1:57 am

I have one question: What is the song played during the intro?

Mathias Reisch

11/13/2010 – 9:41 pm

@Alex: That is some tune I composed a while ago. Thought it would be too long, so the newer tutorials have a much shorter intro. :)

Matt

11/24/2010 – 5:07 am

Awesome tutorials! Best I’ve seen anywhere. Very well explained and helpful!

Bill

01/23/2011 – 7:21 am

i think this was another good tutorial, and i think it’s good how you seem to show different ways of doing things as the lessons go on. but, i’m a little confused about how we seem to be casting the View v as a RadioButton. maybe i missed the part where this is explained, but i don’t understand why we are doing this.

Bobby jindal

03/07/2011 – 11:30 am

Really Thanx…for such Brief Tutorials…

John

03/29/2011 – 6:01 pm

Hi, great tutorials however I have a couple of questions:-
1) Can I download the turorials to watch offline ?
2) In tutorial 5 you created “tvPick = (TextView)findViewById(R.id.current_pick);” 4 times but only one was needed.
3) Why create a new button and set a listener to if with:
RadioButton rb_red = (RadioButton)findViewById(R.id.radio_red);
rb_red.setOnClickListener(radioListener);
Why not like this:
findViewById(R.id.radio_red).setOnClickListener(radioListener);

Thanks John

stephen

03/30/2011 – 6:30 pm

brilliantly explained ,,please dont stop

Tyler

04/05/2011 – 11:31 pm

I’m using API version 8 (2.2) and I’m unable to cast from a View to a RadioButton in this line of code:

RadioButton rb = (RadioButton)v;

Cannot cast from View to RadioButton

jeroen

05/03/2011 – 12:59 am

Hey thnks for the greate tutorial but i have a question.

Whene i was at the point of creating the :
RadioButton rb = (RadioButton)v;
I got an error saying :
‘cannot cast from view to RadioButton’

i have been searching for a solution but cant find it.

the help would be greatly appriciated.

sorry for the english @ times :P

Naveen

05/19/2011 – 8:35 am

Very clear and understandable. Good for android beginners. Thanks.

More advanced tutorials like using google maps and cameras etc will be more helpful, if possible.

And one small question… Developing android application for mobile devices is same as developing on any other device like a tablet ? or are there any differences in the practices we follow.

Naveen

05/19/2011 – 11:56 am

Nice and helpful tutorial

I am very new to Android and Java.. so i have one question here.

why have you defined the ‘radioListener’ and TextView at the class level as globals. what happens if we define inside the onCreate method

Nobita8x

05/27/2011 – 11:32 am

thanks you very much..!