Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Custom Dialog like spinner in android

    • 0
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 3.75k
    Comment on it

    If you want to create a dialog which will look like as spinner dialog of single choice in android which will open in button click event than you can create a custom dialog. Sample code given below :-

    You just have to call this method on click event.

    public void showDialog() {
        CharSequence[] items = {"Red","Green","Blue" };
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setSingleChoiceItems(items, 0,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
    
                        }
    
                    }
                });
        alert = builder.create();
        alert.show();
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: