views:

70

answers:

1

I need more room in a single AlertDialog and when I set .title to null it doesn't show a title but it also doesn't add any space to the AlertDialog. The dialog just starts that much lower on the screen. Not using setPosativeButton has the desired effect but I do want the close button. How can I set the AlertDialog so I can show my long Message starting at the top of the screen?

A: 

for the title and the text , .. in fact, I assumed that you want to create something like "about" menu.

public void ChooseAbout() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(
            "First time here? Check out the FAQ!").setTitle("Hi!");

    builder.show();
}

you can use the .setPositiveButton to finish your activity and .setNegaiveButton to cancel yours.

.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                MyActivity.this.finish();
           }
       })
       .setNegativeButton("No", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
           }
       })
mgpyone
I dont want a title. I want to put the word "Hi!" in the setMessage part, and let the user scroll that off the screen and have the whole screen for the rest of my help text. Setting the title to null or not setting it works but then the alertdialog is just made smaller and leaves off the top where the title would go.
Tim Wayne