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

  • SEARCH
  • Home
  • 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 6076945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:39:55+00:00 2026-05-23T10:39:55+00:00

My end-goal is to have an application that runs a block of code when

  • 0

My end-goal is to have an application that runs a block of code when it (the application, not the activity) is opened up after being left ( back from home screen, etc… )

According to the Activity Lifecycle, this should be the onRestart() event on a per activity basis ( at least how I interpret it )

Both onRestart() and onResume() are being called whether I am returning to the Activity within the application (back button) AND when the app is called back up.

Given this diagram
enter image description here

I am interpreting it this way:

  • RED = movement between activities within the application
  • BLUE = moving to an activity outside the Application

Is my understanding incorrect?

EDIT (Clarifying specific use case)

I’m attempting to use onRestart() to replicate some security logic (PIN Validation) found in onCreate(), but it’s being called even when I press the back button inside the application…

  • 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-23T10:39:56+00:00Added an answer on May 23, 2026 at 10:39 am

    That would be because when unless your are using Fragments each “screen” in your application is a new activity, when you click the back button it restarts the activity of the page before it.

    If I am understanding what you want to do correctly you want to put your code on onCreate, not onRestart.

    SEE COMMENT THREAD FOR ANSWER

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

Sidebar

Related Questions

The end goal is to have some form of a data structure that stores
Error: End tag for 'optgroup' which is not finished. You have probably failed to
I'm working with Django on Linux and I have an application that integrates with
I have an ASP.NET application that makes use of the built in validation controls.
We have an application written in C# .NET that is currently used in production
We have a WPF application that we want to convert to Silverlight. I understand
The goal is to have a single-threaded event-driven framework. The end-user will do something
I have developed an application in eclipse that requires java3d. I have the jars
I have a Rails application that does a lot of media encoding. I am
I am using ASP.NET MVC to develop an application framework. Essentially, the end goal

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.