handler.postDelayed(new Runnable() {
public void run() {
if (MainTab.isRunning == true)
;
{
Dialog.show();
}
}
}, Sec * 1000);
isRunning is a variable and in my activity whenever it calls onStop or onPause method it becomes false. However it's not working, even if I close my app Dialog still wants to add a window and I'm getting errors.