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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:54:00+00:00 2026-05-28T02:54:00+00:00

I had a fairly simple question regarding activites in an Android application. I’m still

  • 0

I had a fairly simple question regarding activites in an Android application. I’m still a newbie.

In my current android application, I have about 10 activities. If one of the activites is already far back in the activity stack, and I want to reopen it, is it okay to call:

Intent iLogin = new Intent(this, Login.class);

startActivity(iLogin);

If it’s still a little confusing, I’ll give an example. The application launches with activity 1. The user then opens activity 2. Later he opens activity 3 to perform an action. After performing the action, I want the user to go back to activity 1. Is it okay to call the code above? Does it get the activity from th stack, or create a new activity? If no, how can I get the activity from the stack?

UPDATE: I’m interested in recycling activities, rather than creating new ones every time. For instance, not all the activities need to be created new one. Some of them only display data, which can be refreshed upon user request.

  • 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-28T02:54:00+00:00Added an answer on May 28, 2026 at 2:54 am

    Is it okay to call the code above? Does it get the activity from th
    stack, or create a new activity? If no, how can I get the activity
    from the stack?

    Ans. If u use this code, another instance of ur 1st activity is created on the stack , And no it is not OK..


    ok. here is an answer based on ur example above:

    I suggest u to use startActivityForResult() to call Activity 2 from Activity 1

    here , Activity 2 will behave as sub-Activity…u can setResult and call finish() in 2nd Activity when it succesfully completes its task…

    but before finish() put a boolean extra like this:

     i.putExtra("passed2nd", true);
    

    this will indicate that the user has gone through this 2nd activity

    Now, u should override, onActivityResult() in your 1st activity,

    here u can check the request code and retrieve boolean extra from 2nd activity..


    now, the important part:
    depending whether the boolean is true or not, u can decide to call 3rd activity using startActivityForResult() with a different requestcode,

    Also, in ur onActivityResult() , u can again check requestcode and do what u wish when activity 3 ends

    so now the control will be back to ur 1st activity when 3rd activity ends succesfully

    Here is an example to get u started.

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

Sidebar

Related Questions

I am thinking about developing a fairly simple facebook application which i have modelled
I have a fairly simple Windows Forms application that I would like to add
I have a Delphi application that I have written a fairly simple wrapper .exe
I have what should be a fairly simple ASP.NET question, and one I thought
I have an HBase schema-design related question. The problem is fairly simple - I
This question may sound fairly elementary, but this is a debate I had with
I am fairly familiar with creating simple custom controls, but I haven't had this
I have a fairly simple query that runs super fast most of the time
I have quite a few simple functions that I had previously kept in my
I have a fairly simple table requestparams ( requestid varchar(64) NOT NULL, requestString text,

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.