Dialog With RadioButton Android Example

private void dialogModeFC() {
	try {
	final AlertDialog alertDialog =	new AlertDialog.Builder(MainActivity.this)
    .setTitle(R.string.select_dialog)
    //.setItems(
    .setSingleChoiceItems(R.array.select_dialog_items, -1
    		, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
 
        /* User clicked so do some stuff 
        <item>Happy New Year</item>
        <item>Merry Christmas</item>
        <item>I Love You</item>
        */
            String[] items = getResources().getStringArray(R.array.select_dialog_items);
// list with boolean variables - which is true
//            for (int i = 0; i < _listMode.size(); i++) {
//            	_listMode.set(i, false);
//            }
//            _listMode.set(which, true);
            dialog.dismiss();
//            new AlertDialog.Builder(MainActivity.this)
//                    .setMessage("You selected: " + which + " , " + items[which])
//                    .show();
        }
    })
    .create();
	alertDialog.show();
	} catch (Exception e) {
		e.printStackTrace();
		Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG)
				.show();//("dialogModeFC", e.getMessage().toString());
	}
}// end dialogModeFC
This entry was posted in Android Examples Code and tagged , . Bookmark the permalink.


Comments are closed.



3,855 views