The popup window has to be shown when the app is started. The function that calls the popup window is located in the OnCreate() method. When I start debugging the app it constantly crashes.
public void ShowPopup() {
dialog.setContentView(R.layout.mainactiv);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.show();
}
And this is the error message:
java.lang.RuntimeException: Unable to start activity ComponentInfo
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Dialog.setContentView(int)' on a null object reference