Como usar o fragmento de diálogo? (showDialog reprovado) Android

Eu entendo que existe essa documentação

http://developer.android.com/reference/android/app/DialogFragment.html#AlertDialog

mas como um novo aprendiz de Android / Java, não é fácil entender a quantidade de código envolvido a partir da gravação de uma caixa de diálogo de alerta simples que aparece com a mensagem 2 opções (sim / não).

Aqui está o código que tenho atualmente no meu arquivo MainActivity:

final private int RESET_DIALOG = 0;

    private OnClickListener resetButtonListener = new OnClickListener() {

        @Override
        public void onClick(View v) {
            showDialog(RESET_DIALOG);

        }
    };

    protected android.app.Dialog onCreateDialog(int id) {
        switch(id) {
        case RESET_DIALOG: 
            AlertDialog.Builder builder = new Builder(this);
            return builder
                    .setMessage("Are you sure you want to reset the count?")
                    .setNegativeButton("No", new DialogInterface.OnClickListener() {    

                        @Override
                        public void onClick(DialogInterface arg0, int arg1) {
                            Toast.makeText(MainActivity.this, "Did not reset!", 5).show();

                        }
                    })

                    .setPositiveButton("Yes", new DialogInterface.OnClickListener() {


                        @Override
                        public void onClick(DialogInterface arg0, int arg1) {
                            Toast.makeText(MainActivity.this, "Did Reset!", 5).show();

                        }
                    })
                    .create();
        }
        return null;
    };

Esta é a minha tentativa de seguir as instruções no site do Android: Arquivo de atividade principal:

final private int RESET_DIALOG = 0;

    private OnClickListener resetButtonListener = new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, MainDialog.class);
            startActivity(intent);

        }
    };

    protected android.app.Dialog onCreateDialog(int id) {
        switch(id) {
        case RESET_DIALOG: 
            AlertDialog.Builder builder = new Builder(this);
            return builder
                    .setMessage("Are you sure you want to reset the count?")
                    .setNegativeButton("No", new DialogInterface.OnClickListener() {    

                        @Override
                        public void onClick(DialogInterface arg0, int arg1) {
                            Toast.makeText(MainActivity.this, "Did not reset!", 5).show();

                        }
                    })

                    .setPositiveButton("Yes", new DialogInterface.OnClickListener() {


                        @Override
                        public void onClick(DialogInterface arg0, int arg1) {
                            Toast.makeText(MainActivity.this, "Did Reset!", 5).show();

                        }
                    })
                    .create();
        }
        return null;
    };

Em seguida, criei uma classe MainDialog: (na verdade, estou perdido em como fazer isso corretamente ou aplicá-la)

package com.proteintracker;

import android.support.v4.app.DialogFragment;

public class MainDialog extends DialogFragment {
    public static MyAlertDialogFragment newInstance(int title) {
        MyAlertDialogFragment frag = new MyAlertDialogFragment();
        Bundle args = new Bundle();
        args.putInt("title", title);
        frag.setArguments(args);
        return frag;
    }
}

Não tenho certeza se devo criar uma nova classe para o fragmento e como aplicá-lo à minha caixa de diálogo atual na tela de atividades.

questionAnswers(4)

yourAnswerToTheQuestion