In your activity write this method.
public static boolean isVisible = false;
@Override
public void onWindowFocusChanged(boolean hasFocus) {
// TODO Auto-generated method stub
super.onWindowFocusChanged(hasFocus);
if(hasFocus)
{
isVisible = true;
}
else
{
isVisible = false;
}
}
and wherever you wish use this boolean to check that is screen visible or not.