The Android Development Tutorials blog contains Basic as well as Advanced android tutorials.Go to Android Development Tutorials to get list of all Android Tutorials.
We can add a List and Radio Buttons in Dialog so that user can make choice.For this we need an array of CharSequences items to use in the list.
Some More Good Android Topics
Android Custom Alert Dialog Example
Customize Radio Button In Android
Customizing Toast In Android
Showing Toast for Longer Time
Customizing Checkboxes In Android
Customizing Progress Bar
To learn Basic of Android Animation go to Android Animation Basics
AlertDialog levelDialog;
// Strings to Show In Dialog with Radio Buttons
final CharSequence[] items = {" Easy "," Medium "," Hard "," Very Hard "};
// Creating and Building the Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select The Difficulty Level");
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
switch(item)
{
case 0:
// Your code when first option seletced
break;
case 1:
// Your code when 2nd option seletced
break;
case 2:
// Your code when 3rd option seletced
break;
case 3:
// Your code when 4th option seletced
break;
}
levelDialog.dismiss();
}
});
levelDialog = builder.create();
levelDialog.show();
More Android Topics:
New Advance Topics:
Android ImageSwitcher Android TextSwitcher Android ViewFlipper
Android Gesture Detector Handling/Detecting Swap Events Gradient Drawable
Detecting Missed Calls Hide Title Bar GridView Animation
Beginning With Android
Android : Introduction Configuring Eclipse for Android Development
Creating Your First Android Project Understanding Android Manifest File of your android app
Advance Android Topics Customizing Android Views
Working With Layouts Working With Views
Understanding Layouts in Android Using Buttons and EditText in Android
Working with Linear Layout (With Example) Using CheckBoxes in Android
Nested Linear Layout (With Example) Using AutoCompleteTextView in Android Grid View
Relative Layout In Android ListView
Table Layout Android ProgressBar
Frame Layout(With Example) Customizing ProgressBar
Absolute Layout Customizing Radio Buttons
Grid Layout Customizing Checkboxes In Android
Android Components Dialogs In Android
Activity In Android Working With Alert Dialog
Activity Life Cycle Adding Radio Buttons In Dialog
Starting Activity For Result Adding Check Boxes In Dialog
Sending Data from One Activity to Other in Android Creating Customized Dialogs in Android
Returning Result from Activity Creating Dialog To Collect User Input
Android : Service DatePicker and TimePickerDialog
BroadcastReceiver Using TimePickerDialog and DatePickerDialog In android
Menus In Android ListView:
Creating Option Menu Populating ListView With DataBase
Creating Context Menu In Android Populating ListView with ArrayList
ListView with Custom Adapter
Toast Working With SMS
Customizing Toast In Android How to Send SMS in Android
Customizing the Display Time of Toast How To Receive SMS
Customizing Toast At Runtime Accessing Inbox In Android
Adding Image in Toast
Showing Toast for Longer Time
TelephonyManager Storage: Storing Data In Android
Using Telephony Manager In Android SharedPreferences In Android
Reading and Writing files to Internal Stoarage
Working With Incoming Calls DataBase
How To Handle Incoming Calls in Android Working With Database in Android
How to Forward an Incoming Call In Android Creating Table In Android
CALL States In Android Inserting, Deleting and Updating Records In Table in Android
Miscellaneous
Notifications In Android
How To Vibrate The Android Phone
Sending Email In Android
Opening a webpage In Browser
How to Access PhoneBook In Android
Prompt User Input with an AlertDialog
This comment has been removed by the author.
ReplyDeleteGreat Article
DeleteAndroid Final Year Project Ideas for Computer Science
Project Centers in Chennai
Thanks, saved me 15 minutes!
ReplyDeleteit worked!! thanks :D
ReplyDeletemine is not working can u provide the whole code thanks....
DeleteShould be "dialog.dismiss();" instead of "levelDialog.dismiss();" at the end of the onClickListener
ReplyDeleteIt should be levelDialog.dismiss();
Deletedialog.dismiss(); works for me
Deletehow to save the state of those radio buttons
ReplyDeleteThanks, helped me a lot!
ReplyDeleteThanks. it's useful example.
ReplyDeleteError:(128, 33) error: variable levelDialog might not have been initialized
ReplyDeleteHow to set selected for radio button in alert dialog?
ReplyDeleteHow can I change the color of the circules???
ReplyDeletehow can I change the color of the circle of the radio button???
ReplyDeleteCannot resolve symbol 'levelDialog'???
ReplyDeleteI am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me. Android gaming
ReplyDeleteHi to everybody, here everyone is sharing such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily motorola two way radios
ReplyDeleteBefore we explore the different radio and service options available, let's first consider some basics that apply to two-way radios and radio services. First, more power means greater distances. https://www.techpally.com/digital-audio-broadcasting/
ReplyDeleteHave you ever been hiking or camping with your family and you and your kids become separated from each other? This is not the time to discover that your cell phone does not have a signal. walky talky
ReplyDeleteI respect this article for the all around scrutinized content and superb wording. I got so included in this material that I couldn't quit perusing. I am inspired with your work and expertise. Much thanks to you to such an extent. running snail radio
ReplyDeleteCool stuff you have got and you keep update all of us. history radio
ReplyDeleteI can read all the opinions of others as well as i gained information to each and everyone here on your site. Just keep on going dude. Check over here: 경마
ReplyDeleteSearching for a great site. I was so impressed to yours. This will probably give me ideas for my work. Thank you 사설토토
ReplyDelete