Skip to main content

Posts

Featured

Radio Button Example Android

Radio buttons are used when you have multiple choices but you have to select only one.

In  Android,  Radio buttons are grouped together by  android.widget.RadioGroup class.If radio buttons are inside Radio group so when one radio button is selected then all others becomes unselected.

Now,I am going to make radio group "Gender " with two radio buttons "Male" &  "Female".

activity_main.xml



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/txtGender"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:text…

Latest posts

SetError method in EditText box

Installing app on memory card by default

Parsing JSON String in Android

SD Card in Android Enulator

AsyncTask in Android

Difference between Handler and AsyncTask

Handler in Android

Spinner in Android

Custom font in android

Tabs in Android