PopupDialog.java

mail@pastecode.io avatar
unknown
java
3 years ago
677 B
2
Indexable
Never
package com.example.test;

import android.app.Dialog;
import android.content.Context;

import androidx.annotation.NonNull;


public class PopupDialog extends Dialog {

    private Context context;
    private String title;


    public PopupDialog(@NonNull Context context, String some_title) {
        super(context, R.style.NoActionBarDialog);
        // Call setTitle function of the Dialog class to set the title
        this.setTitle(title);
    }

    @Override
    public void onBackPressed() {
        //do nothing <----- only this if you want to forbid the user to exit the dialog with the back button,
        // ↓
        // else don't override this method
    }
}