0

I have a requirement like the student names will be taking from the db and showing it in an alert box. a checkbox should be displayed for each student name in that alert so that the user can select the student names from alert box.I have done with the student names.Can any one give an idea to display the checkbox for each student

public void Show_friends()
{
         AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
     try
     {
        builder1.setItems(paymentby,new DialogInterface.OnClickListener() 
        {
         public void onClick(DialogInterface dialog, int item) 
         {

         }
         }
        );
        AlertDialog alert = builder1.create();
        alert.show();


     }
     catch (Exception e) {
        System.out.println("Gesture exception caught");
    }
     System.out.println("================vij=========================inside if");

}
}

This is my code

1

2 Answers 2

0

You will be needing custom dialog to perform this task. see this to know how you can do it.

Sign up to request clarification or add additional context in comments.

Comments

0
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Select the Friends");

    builder.setMultiChoiceItems( paymentby,null, new OnMultiChoiceClickListener()
    {
        public void onClick (DialogInterface dialog, int which, boolean isChecked)
        {


        }
        } 
    ) ;

    builder.setPositiveButton("OK", new DialogInterface.OnClickListener()
    {   
        public void onClick(DialogInterface dialog, int id)
        {         


            }
        }
    );


    AlertDialog alert = builder.create();
    alert.show();

Thanks...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.