I'm trying to create an alertdialog with 3 options, one of which opens up another alertdialog with an editext.

the issue is, once the second alertdialog has been opened up I cant manage to finish or end the one prior to it, it stays hidden underneath the second dialog and pops out again when i begin typing in the editext. 

```
 void generateAlertDialog(long timeSpent) {

        AlertDialog.Builder builder = new AlertDialog.Builder(
                GActivity.this);

        builder.setMessage(
                "The time stayed in the game is " + timeSpent + "s")
                .setTitle("You Lose")
                .setPositiveButton("Reset Game",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int id) {

                                finish();
                                Intent intent = new Intent(GActivity.this,   GActivity.class);
                                Bundle setting = configureGame(RWIDTH, BSIZE, Speed);
                                intent.putExtra("setting", setting);
                                startActivity(intent);

                            }
                        })
                .setNeutralButton("Score List",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int id) {
                                // User clicked score button
                                AlertDialog.Builder builder = new AlertDialog.Builder(
                                        GActivity.this);
                                builder.setMessage(
                                        "Please input the player's name");
                                        setTitle("Score");
                                        final EditText input = new EditText(GActivity.this);
                                        builder.setView(input)
                                        .setPositiveButton("Reset Game",
                                                    new DialogInterface.OnClickListener() {
                                                    public void onClick(DialogInterface dialog,
                                                            int id) {

                                                                }

                                                            })
                                        .setNegativeButton("Exit",
                                                new DialogInterface.OnClickListener() {
                                                public void onClick(DialogInterface dialog,
                                                        int id) {

                                                                }
                                                            });
                                // 3. Get the AlertDialogfrom create()
                                AlertDialog dialogsnd = builder.create();

                                // 4. Show dialog
                                dialogsnd.show();
                            }

                })
                .setNegativeButton("Exit",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int id) {
                                finish();
                                // User cancelled the dialog
                            }
                        });

        // 3. Get the AlertDialogfrom create()
        AlertDialog dialog = builder.create();

        // 4. Show dialog
        dialog.show();
    }

```