RadioButton

Android Dialog with Select Option

In android, by using dialog we can select a option from multiple option using radio buttons.
Example for Dialog with select option :-

[sourcecode language="java"]
public class ExampleApp extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

final String items[] = {"item1","item2","item3"};

AlertDialog.Builder ab=new AlertDialog.Builder(ExampleApp.this);
ab.setTitle("Title");
ab.setSingleChoiceItems(i

Android Dialog with Radio Buttons

Now we can see a easy example of how to use radio groups, actions, and radio buttons dialog in android mobiles.

Example for Android Dialog Radio Buttons :-

[sourcecode language="java"]
public class ExampleApp extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final CharSequence[] PhoneModels = {"iPhone", "Nokia", "Android"};
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_b

Android RadioButton Example

RadioButton is used to select any one option from the given group.

In Android by using RadioGroup only we can use RadioButton. We can add any number of RadioButtons to a single RadioGroup.

Syndicate content