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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T13:11:34+00:00 2026-06-18T13:11:34+00:00

I have a Location activity that can be called from many activities, such as

  • 0

I have a Location activity that can be called from many activities, such as Sign up and Order. In the Location activity the user enters his location, so the activity Location will return this new location to that activity which called it.

So when the Sign up activity calls the Location activity, it has to return the data to the Sign up activity. Another time the Order activity will do the same thing.

Note

I know you will tell me that I should post the code, but I am not asking you to give me the code; I just want some tips, links or good threads.

  • 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-18T13:11:35+00:00Added an answer on June 18, 2026 at 1:11 pm

    In order to start an activity which should return result to the calling activity, you should do something like below. You should pass the requestcode as shown below in order to identify that you got the result from the activity you started.

    startActivityForResult(new Intent(“YourFullyQualifiedClassName”),requestCode);
    

    In the activity you can make use of setData() to return result.

    Intent data = new Intent();
    String text = "Result to be returned...."
    //---set the data to pass back---
    data.setData(Uri.parse(text));
    setResult(RESULT_OK, data);
    //---close the activity---
    finish();
    

    So then again in the first activity you write the below code in onActivityResult()

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == request_Code) {
            if (resultCode == RESULT_OK) {
                String returnedResult = data.getData().toString();
                // OR
                // String returnedResult = data.getDataString();
            }
        }
    }
    

    EDIT based on your comment:
    If you want to return three strings, then follow this by making use of key/value pairs with intent instead of using Uri.

    Intent data = new Intent();
    data.putExtra("streetkey","streetname");
    data.putExtra("citykey","cityname");
    data.putExtra("homekey","homename");
    setResult(RESULT_OK,data);
    finish();
    

    Get them in onActivityResult like below:

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == request_Code) {
            if (resultCode == RESULT_OK) {
                String street = data.getStringExtra("streetkey");
                String city = data.getStringExtra("citykey");
                String home = data.getStringExtra("homekey");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Location that can have Events. I want to have an upcoming_events
I have an activity that goes and pulls all the users calendar events from
I have two class, one is an activity that can handle Chronometer, another is
So I have a location search field that I want to accept pretty much
An app I'm working on can't meaningfully launch until it has a Location from
I have following code to get User Location using GPS.(Code is working fine) But
I am trying to get the current user's location. I have tried to refactor
I have an activity that implements LocationListener in my application and my onLocationChanged method
I am writing an app that requires the user's current location (lastknownlocation won't be
I have location obtained in one activity.Now I want to store it somewhere so

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.