0

I need help with the dialog interface in android. i don't get it.. i' ve searched here to, i got many answers but with every code i used from here my application crashed..

So I make a notes app an you can choice a with an alert dialog which type of note you want. The dialog window is black. So can someone show me how to chage the color maybe simple in white so that i understand how it works?

here is my code:

private void showNewNoteChoices() {
    final CharSequence[] items = {
            getResources().getString(R.string.text_note_type), 
            getResources().getString(R.string.log_note_type),
            getResources().getString(R.string.important_type),
    };

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Select type of note");
    builder.setItems(items, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int item) {
            loadNoteFragment(item, newNoteTitles, null);
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

I know that i have to make an xml file for the specific layout and i have to make an style . Can someone show me how I can make my dialog interface in white?

1 Answers1

0

I would recommend you using Dialog. You can style it the way you want. For example, you create a custom dialog with custom layout like this;

final Dialog dialog = new Dialog(MainActivity.this);
dialog .setContentView(R.layout.custom_layout);

Then you can create views and listeners;

Button button = (Button) dialog.findViewById(R.id.button);
//Other views and listeners etc..

Finally you show it;

dialog.show();
Faruk Yazici
  • 1,942
  • 12
  • 31
  • i don't get it working, need someone who show me what i have to implement in my code and which i have to code in the style style section :/ I'm happy thats me show the options, so when i change something on my code, the app unfortanely stopped.. – Schmiddi1992 Jan 08 '15 at 13:28