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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:27:18+00:00 2026-06-03T09:27:18+00:00

In my Android project, I have 2 Activities. One is MyProject and the other

  • 0

In my Android project, I have 2 Activities. One is MyProject and the other is MyProjectOutput.

In MyProject, there is a button(btnProcess) and it would do some processing and starts the second activity using the following code:

    btnProcess.setEnabled(false);
    // does some network access in an AsyncTask and fetches some stuff, and store some data in the variable 'my_extra_content'
    //...

    Intent i = new Intent(this, MyProjectOutput.class);
    i.putExtra("extracontent", my_extra_content);
    startActivityForResult(i,1);

In the second activity, it has a Button to go back to the main activity(a software back button). And the code is:

    final Button btnBack = (Button) findViewById(R.id.btnBack);
    btnBack.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            //when Back button is pressed, it is cancelled
            setResult(Activity.RESULT_CANCELED);
            finish();
        }
    });

And in the main activity, I am using this to re-enable the button:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    btnProcess.setEnabled(true);

}

My program works fine in the emulator(AVD). And I have given this to one of my friend who owns an Android device. And after testing, he said that the works fine but when the back button(hardware button) is pressed from the main activity, the program is not terminating. Still in memory ! But when I tested in the AVD, when I press the hardware back button from the main activity, it would show the home screen of the phone !

I am using a Nokia device(5230 to be exact). And I know that when we press the “end” button, some programs may still reside in the memory which I have to manually close it via the task manager.

So, I am a bit confused at this problem ! Are there anything that I have to taken care of, while using two activities ?

  • 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-03T09:27:19+00:00Added an answer on June 3, 2026 at 9:27 am

    It’s not supposed to terminate. There have been many many articles and questions on this. Android itself decides when to remove an activity from memory. This is based on hardware specs on the phone, memory utilization, and other factors. So pressing End/Back might or might not leave the application in memory. Using a task killer on Android while popular, is a very bad idea.

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

Sidebar

Related Questions

In my android project, I have many activities and some of them already extend
I have an Android project with two activities. One is my main activity, using
I have an Android project in eclipse IDE which was working. After some imports
I have a library android project Library (with activities and all) and a normal
I have two activities in my Android project: Google Map Activity List Activity I'm
I have a little Android project going on which involves some IPC where client
I have been developing a number of Android activities in a project in Eclipse.
In my android project I have some activity classes, and also simples java classes.
I have one question about Android. I need to run one of my activities
I write simple project in android. I have ~10 activities, and the user flipping

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.