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 7917367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:07:21+00:00 2026-06-03T15:07:21+00:00

I have this question when I am studying an open source Android project. I

  • 0

I have this question when I am studying an open source Android project.

I have an activity A1 that calls another activity A2 in its “onCreate” method. However, there are code statements before and after the “startActivity / startActivityForResult” method. I do not know the execution sequence in A1 after the “startActivity / startActivityForResult” method.

The code framework for A1 is listed below :

public void onCreate(Bundle bundle) {
   <code statements before>
   this.startActivityForResult(.....);  // Start A2 here.
   <code statements after>
}

public void onResume() {
   <code statements>
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   <code statements>
}
.....

I wonder whether A1 would firstly finish its execution cycle (i.e. “onCreate” -> “onStart” -> “onResume” -> “onPause” -> “onStop”) before it would call A2, or just firstly finish “onCreate” before calling A2, or has other execution logic ?

Moreover, when A2 returns (finishes) and “onActivityResult” in A1 is called, would A1 then executes “onRestart” -> “onStart” -> “onResume” after executed the “onActivityResult” method ?

Because both A1 and A2 have its own UI, I think that the 2 activities may not execute concurrently with two different threads. Does anyone know the exact execution sequence in this case ?

Thanks in advance for any suggestion.

  • 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-06-03T15:07:22+00:00Added an answer on June 3, 2026 at 3:07 pm

    They will not execute on different threads, both will be on the main UI thread. You can’t guarantee when/if onResume() and onPause() will be called as described in the Android lifecycle docs here.

    If you’re starting another activity in the onCreate() of an activity, you should expect that the A1 UI is not loaded (the first time). You should expect to see it when A2 returns a result.

    Other than that, I would suggest just trying it out and seeing for yourself.

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

Sidebar

Related Questions

I have this question: How could I call a codebehind method from jquery? I
I have this little question that's been on my mind for a while now.
I'm studying for upcoming interviews and have encountered this question several times (written verbatim)
I have this question in which I have a SQL Server Compact Edition database
I have this question because I am not familiar latest generation of MS VS
I have this question relating to Lucene. I have a form and I get
I have this question, i am just throwing it out there. I am implementing
Dear all,Now i have this question in my java program,I think it should be
ASP.Net MVC3 is cool and all but I have this question more out of
I am new to db4o . I have this question in mind: when 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.