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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:13:16+00:00 2026-05-15T06:13:16+00:00

I have 2 activities. In child activity i have put something like that in

  • 0

I have 2 activities. In child activity i have put something like that in onPause():

if (isFinishing()) {
 final Intent intent = new Intent();
 intent.putExtra(SOME_DATA, value);

 setResult(RESULT_OK, intent);
 Log.i("test", "Result set to RESULT_OK");
}

In parent activity i check resultCode when child activity is destroyed, and this is what i have noticed:

  1. If i destroy child activity by some action (in some condition i invoke finish()), then resultCode is RESULT_OK
  2. But when i destroy by pressing return key (i works only in emulator so its ESC) who kills activity, then resultCode read in parent onActivityResult method equals 0 (RESULT_CANCELD).

“test” log read in each case is the same.

  • 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-15T06:13:17+00:00Added an answer on May 15, 2026 at 6:13 am

    Most likely the thing that is destroying your activity resets the result after onPause is called to RESULT_CANCELED. This makes sense, since the activity did not finish happily.

    What are you trying to accomplish by always setting the result code to RESULT_OK?

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

Sidebar

Related Questions

I have a TabHost activity that are switching activities, so my main looks like
i have 2 activities that share data between them: Activity B (child) @Override public
I have a base activity and some child activities like A, B, C and
I have five activities/screens that I would like to be able to swipe between,
I have 2 activities. The first activity is an activity that parses JSON data
I have an ActivityGroup with several child Activities. Recently I discovered that the onBackPressed
I have two activities with exactly same intent filters and I would like to
I have 40 activities that do not depend on each other. I want to
I have two activities. In first I come to the second activity from first
In my application I have several activities, the main screen has 4 buttons that

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.