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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:22:06+00:00 2026-05-28T04:22:06+00:00

I have an activity A that launches B with an Intent. (B is a

  • 0

I have an activity A that launches B with an Intent. (B is a MapActivity and has some async code)

in B i have the following code

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    // TODO Auto-generated method stub
 if ((keyCode == KeyEvent.KEYCODE_BACK)) {
//          Log.d(this.getClass().getName(), "back button pressed");

     finish();
     return true;
    }

    return super.onKeyDown(keyCode, event);
}

This simply not work. I mean that when I press the back button on the phone, the current activity B disappears and the activity A that launched B is shown.

If I press again on A the button that launch B, I see B is exactly how it was when I closed it. SAME text in textboxes, same Map position… So i think the activity B is not really closed.

How can I close it for real so when I launch again it, activity B is cleas as new born?

EDIT: just to make the question clearer:
I want it to work like this: when the user is on activity B and BACK button is pressed, B has to be closed and destroyed. When the user again launches B from A, B has to be launched as a NEW activity, with blank field, reset map, etc., etc., … just like the first time the user launches B from A.

  • 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-28T04:22:06+00:00Added an answer on May 28, 2026 at 4:22 am

    As i stated in my last comment to the post, @Jianhong given me the correct answer (aslso if as a comment). As he don’t copied the comment as answer in time, i add this answer and mark it as the ACCEPTED. Thanks @Jianhong!

    Answer:
    @Jianhong OMG! you completely right! i checked for this problem in past days but i couldn’t find it as… i’ve not UPDATED from SVN. my coworker inserted lines of code that prefill fields by some static var!

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

Sidebar

Related Questions

I have a main activity that launches a child activity using the following code:
I have one activity with that launches another activity that has a EditText-view. When
I have activity A, which launches activity B via an intent. Activity A has
I have an Activity that launches a Camera Intent like this (nothing special): Intent
I have an activity that launches another activity with startActivityForResult method. I would like
I have an activity that has a progressbar and the same activity spawns a
I have an activity that has a TabHost containing a set of TabSpecs each
I have an activity that runs some ASCII control over a network port to
I have an activity that lets the user load some data when they press
My app needs to have a intent-filter that responds to a Intent that has

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.