Android Java: How do I prevent my Dialog box from showing MainActivity appname briefly when the Dialog closes?

You can achieve this by setting the android:theme attribute to @android:style/Theme.NoTitleBar on your element in your AndroidManifest.xml like this:

<activity android:name=".Activity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

The code you've posted is not enough to figure out why this is happening, but there is one universal solution not to see Activity title(that is is set in the label field of manifest).

Declare in your styles.xml a new theme like

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:windowContentOverlay">@null</item>
</style>

and after that make it to be the theme of your activity like this

 <activity
           ...
           android:name="boha.notify.MainActivity"
           android:theme="@style/AppTheme.NoActionBar">
           ...
</activity>

While I am not 100 percent sure(because this behavior can be altered in an actual code of your activity) I think it might help.

I hope it will help.


notify.setOnDissmissListener({CancelTimer()
    activity.finishAndRemoveTask()
    dialog.dismiss()})