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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:23:56+00:00 2026-05-13T08:23:56+00:00

I am facing with a problem related startActivityForResult() To start SecondActivity from FirstActivity :

  • 0

I am facing with a problem related startActivityForResult()

To start SecondActivity from FirstActivity :

Intent intent = new Intent();
intent.setClass(FirstActivity.this, SecondActivity.class);
intent.putExtra("key1", "12345");
startActivityForResult(intent, 0);

And handles result :

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    //TODO handle here. 
}

To send the message to FirstActivity from SecondActivity :

in SecondActivity :

setResult(0);

I can’t handle the result on onActivityResult in FirstActivity.
It never works for my application.

My OS is : 1.5

What is wrong here?

  • 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-13T08:23:56+00:00Added an answer on May 13, 2026 at 8:23 am

    startActivityForResult is meant to be used for situations where you want to select a piece of data, or perform some sort of action that your Activity or application cannot do.

    For example, you want to pick a contact, so you launch the contacts application, the user chooses the person they want, and you get sent the result. Or you want to take a photo, so you launch the camera application and ask it to send you the photo once it’s done. This action is completely separate from your first activity that calls startActivityForResult.

    The Activity you’re launching will not send you the result until that Activity has completed, i.e. finish() has been called.

    So in your case, you need to call this in SecondActivity:

    setResult(...);
    finish();
    

    before FirstActivity will receive the result in its onActivityResult method. Of course, this means that SecondActivity is now gone and FirstActivity is top of the stack again.


    It’s not possible to send the result to FirstActivity then close it while keeping SecondActivity still active. In this case you should just handle whatever this ‘result’ is in SecondActivity, or send it off to a Service you define to do whatever processing it is you want.

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

Sidebar

Related Questions

I'm currently facing a variable substitution related problem in groovy. While this is quite
I am facing a problem related to get out all the controls from some
I am facing a problem related to the scope of the variables used .
iam facing problem in passing array to view. this is my controller code.. function
I am facing problem to get variable from query string. I have used htaccess
I am facing with problem related Http Connection. MY code : URL url =
Hi i'm facing this problem. I have an application with 2 activities: -Activity A
I am facing the following problem on a GeForce GTX 580 (Fermi-class) GPU. Just
I am facing a peculiar problem related to a hosted WCF service (.NET Framework
Since some days, I have been facing a problem in Visual Studio 2008, related

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.