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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:12:45+00:00 2026-06-02T03:12:45+00:00

I have two Applications, A and B, both applications are made by me but

  • 0

I have two Applications, A and B, both applications are made by me but they are in different packages. I want to extract some data from my Activity B to my Activity A.

For this I use ActivityA.startactivityforresult(ActivityB).

This works ok, up until I need to retrive my data from ActivityB, then I start getting NullpointerExceptions for my getExtra() calls.

ActivityA:

protected void someMethod()
{
    Intent intent = getPackageManager().getLaunchIntentForPackage("some.package.app");
    intent.putExtra("action", "retrieveData");
    startActivityForResult(intent, 7854);
}

protected void onActivityResult (int requestCode, int resultCode, Intent intent)
{
    Log.d(TAG, "test: " + intent.getExtras().getString("test"));
}

ActivityB:

protected void onResume ()
{
    if (getIntent().getExtras() != null && getIntent().getExtras().getString("action").equals("retrieveData"))
    {
        Intent intent = getIntent();
        intent.putExtra("test", "This is a test response");

        setResult(7854, intent);
        finish();
    }
}

OUTPUT: test: null

Am I doing something wrong, or is this simply not allowed?

UPDATE

04-18 18:28:34.908: E/AndroidRuntime(15711): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=7854, result=0, data=null} to activity {dk.rasive.testA/dk.rasive.testA.TestActivity}: java.lang.NullPointerException
04-18 18:32:48.892: E/AndroidRuntime(15801):    at dk.rasive.testA.TestActivity.onActivityResult(TestActivity.java:245)

Line 245 contains this code

Log.d(TAG, "test: " + intent.getExtras().getString("test"));
  • 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-02T03:12:46+00:00Added an answer on June 2, 2026 at 3:12 am

    I haven’t tried with Activities in different Applications but Activity A needs to override

    onActivityResult(int requestCode, int resultCode, Intent data)
    

    Also

    setResult
    

    takes a ResultCode not a RequestCode although that won’t make a difference in the snippet you posted.

    EDIT:

    androidmanifest.xml

        <activity
            android:name="ActivityB"
            <intent-filter>
                <action android:name='retrieveData'/>
            </intent-filter>
        </activity>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two web applications in the same solution. They both use different membership/profile
I have two applications: c++ service and a RoR web server (they are both
I have two rails applications App1 and App2 both running on separate URLs but
I have two separate applications (both part of the same system) that share a
I have two user types in my application: Investors and Advisors , they both
In my application, I have two different activities and both are list activities. I
I have made an application which calls the phone's contact list but i want
I have two ASP.NET applications: the first is backend app made with WebFroms, the
Alongside the implicit User Interface thread, i have made two threads (runnables), both having
We have two tables in our application that both have a ShowOrder column. We

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.