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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:38:43+00:00 2026-06-12T13:38:43+00:00

I call an activity called Activity1 from an Activity called MainActivity using the following:

  • 0

I call an activity called Activity1 from an Activity called MainActivity using the following:

Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    startActivity(intent);

So, when the control comes to Activity1. The normal activity lifecycle is started. i.e onCreate() is called and so on.

when i click the back button when the control is in Activity1. The finish method is called, which in turn calls the onDestroy() and now the control is back with the MainActivity screen.

@Override
public void onBackPressed() {
        Log.d(TAG, "onBackPressed()");
        finish();
    }

The next time i call Activity1. The onCreate is called again as i called the onDestroy (when i pressed the back button) from the previous call.

Question:
1. is there a way to pass control back to the MainActivity when the back button is pressed without having to call the “finish()” method?
2. problem with calling finish, every time i call Activity1 from MainActivity, A new instance of Activity1 is created. that is the lifecycle again starts from onCreate()..
i do not want this to happen as this is has become a major performance issue.

The main point i’m looking for is whether i can start the activity1 from the resume state rather than oncreate, when i call it after the first time.

  • 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-12T13:38:44+00:00Added an answer on June 12, 2026 at 1:38 pm

    I don’t believe you need to call the “finish()” method on onBackPressed. Android does that for you when you press the back button. The onBackPressed is used to last minuet tidy up (save stuff to sharepreferences, etc).

    Android default behaviour is to call onCreate whenever a new activity is place on the screen. You cannot call a new Intent without this to happen.

    I’m not sure why this is performance issue for you. Can you go in a little more detail what activity1 is doing? Are you doing heavy network communication? Is it possible you can cache the store results?

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

Sidebar

Related Questions

I have a Activity called main. If I call Toast.makeText(this, Hello World from main,
I start an activity from the main one using a Intent: Intent i =
I am launching activities from the main activity in my app using the call
This one has me stumped. I need to call an activity method from within
from an Activity (UI) I call a class to get my location. At onPause
I have an Activity from which I call a PopupWindow. My question is how
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
Edit: the answer is not to call startActivityForResult on the called Activity object, instead
I have an activity than can be called from my parent activity and from
I want to simply call one function that is defined in BroadClass Activity from

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.