how to check screen on/off status in onStop()?

You can try to use PowerManager system service for this purpose, here is example and official documentation (note this method was added in API level 7):

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
boolean isScreenOn = pm.isScreenOn();

EDIT:

isScreenOn() method is deprecated API level 21. You should use isInteractive instead:

boolean isScreenOn = pm.isInteractive();

http://developer.android.com/reference/android/os/PowerManager.html#isInteractive()


As mentioned in this answer to a similar question. In API 21 and above we can use the DisplayManager to determine the state of the display. This has the advantage of supporting the querying of multiple displays:

DisplayManager dm = (DisplayManager) 
context.getSystemService(Context.DISPLAY_SERVICE);
for (Display display : dm.getDisplays()) {
    if (display.getState() != Display.STATE_OFF) {
        return true;
    }
}
return false;

Depending upon your circumstance it might be more appropriate to query the display that a particular view is being displayed on:

myView.getDisplay().getState() != Display.STATE_OFF