Skip to main content

Posts

Showing posts with the label radiobutton

Radio button Sample Program

Simple radio button example  Radio buttons are two-state button which allow the user to select one options from a group. If you have more than one radio button, then use radio group, so that when one radio button is selected, all others are automatically deselected. In this example, I’ll show a simple example of a radio button RadiobuttonExampleActivity.java package com.example; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; public class RadiobuttonExampleActivity extends Activity {     /** Called when the activity is first created. */     @Override     public void onCreate(Bundle savedInstanceState) {         super .onCreate(savedInstanceState);       ...

Custom Radio button in android

Custom radio button in android CustomRadiobuttonActivity.java package com.example; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; public class CustomRadiobuttonActivity extends Activity {     /** Called when the activity is first created. */     @Override     public void onCreate(Bundle savedInstanceState) {         super .onCreate(savedInstanceState);         setContentView(R.layout. main );         Button button=( Button )findViewById(R.id. button1 );         button.setOnClickListener( new OnClickListener() {             ...