Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7575871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:47:06+00:00 2026-05-30T16:47:06+00:00

How would an Activity know if it has just been brought back from either

  • 0

How would an Activity know if it has just been brought back from either being minimized (e.g., the user pressed Home and did other stuff and then brought the app back into the foreground afterwards) or from the screen timing out and the screen going black?

If I hit Home while on an app, then OnDestroy doesn’t necessarily fire, does it? Same goes for if the screen times out. So it doesn’t seem there will be a way to set a flag as soon as the screen leaves the foreground.

OnResume seems to fire all the time, definitely not just when an Activity is brought back to the foreground.

Watching LogCat I don’t see anything that gives me any hints, so here I am…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:47:07+00:00Added an answer on May 30, 2026 at 4:47 pm

    I think this will explain everything you need:
    http://developer.android.com/reference/android/app/Activity.html

    But basically: the onResume() will always fire when the activity comes back to foreground,
    and the onPause() will fire when activity goes to background (or destroyed). So overriding both is the answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how to get data from preference activity when my
how data is generated without user activity has never been quite clear to me.
I would know if there is the possibility to create a new Android Activity
I would like to start a broadcast receiver from an activity. I have a
I know Android's Activity model is a bit different from what I usually consider
I know this has been asked in many different ways but I still can
I would like to know if it's possible for the user, or for the
I know that this question has been resolved in many other threads for example:
Sorry, I know that this topic has been covered a bit. I've read the
I have a ImageView which shows a picture that has been taken from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.