I want to quit the app from the dialog

I want to quit the app when I press the exit button in the dialog.
Therefore, when I press the end button, I want to execute moveTaskToBack (true);or finish () ;, but I get an error that the symbol cannot be found.

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate (savedInstanceState);
        setContentView (R.layout.activity_main);
        DialogFragmentA dialogFragment = new DialogFragmentA ();
        dialogFragment.show (getSupportFragmentManager (), "DialogFragmentA");
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
public class DialogFragmentA extends DialogFragment {
    public Dialog onCreateDialog (Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder (getActivity ());
        // dialog title
        builder.setTitle ("Do I want to exit the app");
        // Button to exit the app
        builder.setPositiveButton ("Exit app", new DialogFragmentA.DialogButtonClickListener ());
        // I want to close the dialog only when this button is pressed
        builder.setNeutralButton ("Cancel", new DialogFragmentA.DialogButtonClickListener ());
        AlertDialog dialog = builder.create ();
        return dialog;
    private class DialogButtonClickListener implements DialogInterface.OnClickListener {
        public void onClick (DialogInterface dialog, int which) {
            switch (which) {
                // Process to close the application
                case DialogInterface.BUTTON_POSITIVE:
                    // moveTaskToBack (true);Error: Unable to find symbol
                    // finish ();error: cannot find symbol
                 // Process to close the dialog
                case DialogInterface.BUTTON_NEGATIVE: