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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:35:43+00:00 2026-06-01T11:35:43+00:00

I have a problem on an Android app. I have 2 activities : Activity1

  • 0

I have a problem on an Android app.

I have 2 activities : Activity1 and Activity2.

Activity1 is my default activity.
Activity2 is a second activity.

Here is the code in Activity1 for the onKeyDown with KEYCODE_BACK :

finish();
return true;

Here is the code of my Activity2 for the same event :

Intent myIntent = new Intent(this, Activity1.class);
startActivityForResult(myIntent, 0);
return true;    

My problem is :
– I start the app, I press “Back” : application is closed – OK
– I start the app, I go to Activity2 (through a button), I press “Back” : I’m back to Activity1, I press again “Back” : I’m back to Activity2 instead of applying “finish()”.

Can somebody tell me what I’m doing wrong?

For information, my Activity2 is called like this:

Intent myIntent = new Intent(this, Activity2.class);
startActivityForResult(myIntent, 0);
return true;

Thanks in advance.

Romain

  • 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-01T11:35:45+00:00Added an answer on June 1, 2026 at 11:35 am

    The application is exactly behaving according to your code. Nothing is wrong. The question is what do you expect on how you want your application(activities) to behave. Another thing is that don’t override back button. Android user know how back button behave and they want it to behave consistently across applications and if yours behave differently, they will be pissed.

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

Sidebar

Related Questions

Here's the problem. In my app, I have 5 tabs which contains activities. In
I have a problem with my Android app. I have three Activities that all
I have a problem regarding Android App. I have created an application that download
I'm using ormlite for my android-app. But now i have a problem. I have
I have a strange problem in my PhoneGap-based android app. On certain screens, the
I have a problem with my soundboard app for android. When I test it
I published my first app to the Android Market an have the weird problem,
I have some problem with Android AsyncTask. There is an Activity which contains some
I have an Android app, in which Activities fire long running operations that run
I am building an Android app, and I have a problem to get resource

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.