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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:26:40+00:00 2026-05-20T10:26:40+00:00

I have three activities that I can call A, B and C. I want

  • 0

I have three activities that I can call A, B and C. I want to pass information between the three like this: A–>B–>C–>A. In A I want to check if there is a bundle passed (the first time, start-up, there won’t be one for example).
The data is passed from A-B with a normal bundle. From B–>C I use this:

Intent i = new Intent(getApplicationContext(), FlashcardView.class);
             i.putExtra("rattning", rattning);
             i.putExtra("noqs", noqs);
             i.putExtra("categoryid", categoryid);
             CreateTestView.this.finish();
             startActivityForResult(i, 0);

It is received and then sent onwards to A like this:

  Intent data = new Intent(FlashcardView.this, MenuView.class);
                       data.putExtra("point", point);
                       data.putExtra("noqs", noqs);
                       setResult(RESULT_OK, data);
                       finish();

It is received at A like this:

 @Override 
   protected void onActivityResult( int req, int resp, Intent data ) {
        super.onActivityResult(req, resp, data);
        // process your received "data" from GameActivity ...
        Bundle b = getIntent().getExtras();
        noqs = b.getInt("noqs");
        point = b.getInt("point");
        mTvCat.setText("hhhhhh"+point+noqs);
        publishOnFacebook(point,noqs);
    }

It seems though like the bundle is lost on the way from C–>A. When I passed it back from C–>B there was no problem. I think this happens cause B is the activity that starts C, and therefore C falls back to B, not A. I made a go-around by calling finish() on B, so C goes back to A instead. BUt in doing this I lose the bundle. Or at least I think so.

Has anyone seen this before? Is there a better way of doing this? How can I prevent losing the bundle on a passing between more than two activities? THanks!

Edit:

Edit: Here is the error code on receiving the broadcast:

  03-07 12:57:59.394: ERROR/AndroidRuntime(803): java.lang.RuntimeException: Error receiving broadcast Intent { act=my_action (has extras) } in com.crystalcodeab.Flashcard.MenuView$1@47681ad0
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:981)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at android.os.Handler.handleCallback(Handler.java:587)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at android.os.Looper.loop(Looper.java:143)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at android.app.ActivityThread.main(ActivityThread.java:5068)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at java.lang.reflect.Method.invokeNative(Native Method)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at java.lang.reflect.Method.invoke(Method.java:521)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at dalvik.system.NativeStart.main(Native Method)
03-07 12:57:59.394: ERROR/AndroidRuntime(803): Caused by: java.lang.NullPointerException
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at com.crystalcodeab.Flashcard.MenuView$1.onReceive(MenuView.java:56)
03-07 12:57:59.394: ERROR/AndroidRuntime(803):     at 
  • 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-20T10:26:40+00:00Added an answer on May 20, 2026 at 10:26 am

    I think the problem lies in how you finish activity B. When you finish Activity B, the result from B is sent back to A and the Activity is gone. C has no way of knowing it should return its result to A, as it is only aware of Activity B.

    My suggestion to you is that you should use a BroadcastReceiver in Activity A. Then in Activity C you can send a Broadcast with the data you wish to be received by A:

    In A:

    IntentFilter filter = new IntentFilter("my.action");
    BroadcastReceiver receiver = new BroadcastReceiver() {
      public void onReceive(Context context, Intent intent) {
        if(intent.getAction().equals("my.action")) {
          // Do my stuff
        }
      }
    }
    registerReceiver(receiver, filter);
    

    In C:

    Intent data = new Intent("my.action");
    data.putExtra("point", point);
    data.putExtra("noqs", noqs);
    sendBroadcast(data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have three divs in a container that I want to float over a large
My app has three tabs, A, B, C that have three distinct activities. Tab
I have a TabActivity that hosts other three activities. If the first tab is
I have got a website where people can share activities just like Twitter, users
I'm new to JNI. I have two (or more) Activities that want to use
In my application I have more that 20 activities and I want to ask
I have three activities A, B and C. A starts B with startActivityForResult(getIntent(), ACTIVITY_B);
Ill first tell you what I am doing. I have three activities in the
I have three divs, within a content div. Container width 70%. Within that I
I have a Windows Service that performs a number of periodic activities, and 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.