O'Reilly logo

Android Development Tools for Eclipse by Sanjay Shah, Khirulnizam Abd Rahman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a RadioGroup, RadioButton, and a TextField

Android SDK provides two types of radio controls to be used in conjunction, where only one control can be chosen at a given time. RadioGroup (android.widget.RadioGroup) is used to encapsulate a set of RadioButton controls for this purpose.

Before we add the RadioGroup and RadioButton control, let's add the label Distance and the TextField to allow users to provide inputs. Open the activity_main.xml file, and add following entries:

 <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="14dp" android:layout_marginTop="44dp" android:text="@string/distance ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required