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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:29:14+00:00 2026-06-01T18:29:14+00:00

In an activity (say A) I have to perform a certain task depending on

  • 0

In an activity (say A) I have to perform a certain task depending on the result of another activity (B). I start activity B using startActivityForResult(). The pseudo code is something like this:
(in activity A)

//Statements
//startActivityForResult(activityB)
//get the result in some local variable for activity A. result is a boolean
//if(result==true) do something
//else do something else

Now the problem I’m facing is that after starting the activity B, it doesn’t wait for the result to arrive from B. Instead, it proceeds and uses the default value of the boolean result.
Any solution?

If this particular block was in another thread, i could write a synchronized block and
issue a wait() after starting the activity B, and then notify() in the onActivityResult().
But since there’s just a single thread, that’s not an option right?

Should mention that activityB takes a user input of Yes/No and returns that. So on starting it, the result is not immediately available

  • 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-01T18:29:15+00:00Added an answer on June 1, 2026 at 6:29 pm

    Any solution?

    Put your last two lines from your code listing in onActivityResult(), as is described in the Android documentation.

    More importantly, you also need to rewrite activityB to actually follow the instructions for using setResult() to pass results back to activityA.

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

Sidebar

Related Questions

I have an Activity ActivityA say. From ActivityA I start ActivityB using an Intent,
I have an activity(say, MyActivity) that contains fragments, and i am using fragmentTransaction.replace(XX,YY) for
Say if I have a locationManager(LM) object in activity A, which is my main
is there a way to create a task/activity report (say a weekly report) off
Lets say i have a few activity A,B and C. Activity A is run
Let's say I have an Activity which displays a View containing a TextView .
Let's say we have a standard MainActivity that extends Activity . It contains onCreate
Let say that I have two Activity to develop in Android. Upon the end
Say i have one activity that gets a cookie and then starts a new
What is the recomendded pratice when i switch to another activity? Lets say I

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.