0

I need to show AlertDialog#1 with custom layout R.layout.add_new_entry with button mybtn and this button should open another AlertDialog#2 with single choice list and after choosing one of them this dialog (AlertDialog#2) should send index of shoosen into first dialog (AlertDialog#1) and set some values into EditText field in AlerDialog#1. Is it possible to make?

My dialog#1 with custom layout:

AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    builder.setView(inflater.inflate(R.layout.add_new_entry, null))
            .setTitle(dialogTitle)
            .setPositiveButton("Add", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    // My functions...
                }
            })
            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    // My functions...
                }
            });

    builder.create().show();

I'v spent all night on it and i can't find any good examples or articles how to open dialog inside dialog. Thanks

PePe
  • 443
  • 2
  • 5
  • 15
  • 1
    First, have you tried and what is/isn't working? Second, this seems "messy" to me. You could create both as `Activities` with a `Dialog Theme`. It's very simple to do so. [This answer shows how](http://stackoverflow.com/questions/16071500/is-it-possible-to-keep-a-dialog-open-after-clicking-the-neutral-button/16071673#16071673) – codeMagic Apr 17 '14 at 23:39
  • Thank you. I made AlertDialog#1 as Activities `android:theme="@android:style/Theme.Dialog"` and second dialog as simple dialog and itmade all work for me. – PePe Apr 18 '14 at 12:34
  • No problem. Glad it works for you – codeMagic Apr 18 '14 at 12:41

0 Answers0