I want to set my setOnShowListener() method to prevent dialog from closing, so I write something like this,

```
public Dialog update_pop_up()
{
    final AlertDialog.Builder builder = new AlertDialog.Builder(UgJadwal.this);
    LayoutInflater inflater = UgJadwal.this.getLayoutInflater();
    View dialogView = inflater.inflate(R.layout.updatepopup, null);
    builder.setView(dialogView);
    builder.setIcon(R.drawable.update);
    builder.setTitle("Update schedule");

    builder.setPositiveButton(R.string.update, new DialogInterface.OnClickListener()
    {
        @Override
        public void onClick(DialogInterface dialog, int id)
        {

        }
    });

    builder.setNeutralButton(R.string.retrieve, new DialogInterface.OnClickListener()
    {
        @Override
        public void onClick(DialogInterface dialog, int id)
        {

        }
    });

    builder.setNegativeButton(R.string.cancel, null);
    return builder.create();

    builder.setOnShowListener(new DialogInterface.OnShowListener()
    {
        @Override
        public void onShow(DialogInterface dialog)
        {
            Button retrieve = builder.getButton(AlertDialog.BUTTON_NEUTRAL);
            retrieve.setOnClickListener(new View.OnClickListener()
            {
                @Override
                public void onClick(View v)
                {
                    //do nothing;
                }
            });
        }
    });
}

```

At least there are two error prompted by eclipse, the first one is on the `setOnShowListener` that say "The method setOnShowListener(new DialogInterface.OnShowListener(){}) is undefined for the type AlertDialog.Builder" and the other one is on the `builder.getButton(AlertDialog.BUTTON_NEUTRAL)` that say "The method getButton(int) is undefined for the type AlertDialog.Builder". I just wonder why it raises errors becuase I have do it right I think. Does everyone have an idea to fix it, thanks.

[UPDATE!!]
Thanks everybody for your help. This is my final methoD on `setOnShowListener()`

```
dialog.setOnShowListener(new DialogInterface.OnShowListener()
    {
        @Override
        public void onShow(DialogInterface dialog)
        {
            Button retrieve = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEUTRAL);
            retrieve.setOnClickListener(new View.OnClickListener()
            {
                @Override
                public void onClick(View v)
                {
                    datasource.opentoread();
                    String[] hari = datasource.fetchDaily(ids.getText().toString());
                    datasource.close();
                    day.setText(String.valueOf(hari[0]));
                    subject.setText(String.valueOf(hari[1]));
                    time.setText(String.valueOf(hari[2]));
                    location.setText(String.valueOf(hari[3]));
                    lecture.setText(String.valueOf(hari[4]));
                    Toast.makeText(getApplicationContext(), "Retrieve success", Toast.LENGTH_LONG).show();
                }
            });
        }
    });
    return dialog;

```