---
title: "Which activity lifecycle method gets called whenever the screen of the device turns off an then turns on?"  
description: "Which activity lifecycle method gets called whenever the screen of the device turns off an then turns on?"  
author: "Hemant Patel"  
published: 2018-01-22  
canonical: https://answers.mindstick.com/qa/33377/which-activity-lifecycle-method-gets-called-whenever-the-screen-of-the-device-turns-off-an-then-turns-on  
category: "technology"  
tags: ["android"]  
reading_time: 1 minute  

---

# Which activity lifecycle method gets called whenever the screen of the device turns off an then turns on?

Which [activity](https://www.mindstick.com/blog/23160/fidgetsguide-exercise-guides-newsletters) [lifecycle method](https://answers.mindstick.com/qa/33378/which-activity-lifecycle-method-gets-called-whenever-a-dialog-opens-on-screen) gets called whenever the [screen](https://www.mindstick.com/forum/1382/print-something-that-is-not-shown-on-the-screen-using-wpf) of the [device](https://www.mindstick.com/articles/331690/how-much-time-should-we-spend-on-your-devices-every-day) turns off an then turns on?

## Answers

### Answer by Prateek sharma

**onPause()** [method](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business) will be called right before the screen turns off and **onResume()** method will be called right before the screen turns on.

**onPause()** method of the activity [lifecycle](https://yourviews.mindstick.com/view/10392/how-is-the-vendor-lifecycle-impacting-the-energy-sector-in-north-america) is called when the user is leaving the activity. for example, we can use this in music player where we pause the music when activity is paused and resumed shortly after user comes back.

**onResume()** method is called as soon as the user returns to the activity. whenever any interruption occurs the activity moves to the Pause state and system will call the onPause method. the onResume invocation means that the activity moves in the foreground.


---

Original Source: https://answers.mindstick.com/qa/33377/which-activity-lifecycle-method-gets-called-whenever-the-screen-of-the-device-turns-off-an-then-turns-on

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
