I have three actions, which I can name A, B and C. I want to transfer information between three, like this: A → B → C → A. In A I want to check if there is a transmitted packet (for the first time, when start, they will not be, for example). Data is transferred from AB with normal stratification. 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 accepted and then sent in the following way:
Intent data = new Intent(FlashcardView.this, MenuView.class); data.putExtra("point", point); data.putExtra("noqs", noqs); setResult(RESULT_OK, data); finish();
It is obtained as follows:
@Override protected void onActivityResult( int req, int resp, Intent data ) { super.onActivityResult(req, resp, data);
It seems like the beam gets lost on the way from C → A. When I transferred it back from C → B, there were no problems. I think this happens because B is activity starting with C, and therefore C goes back to B, not A. I made a turn by calling finish () on B, so C goes back to A. BUt, doing this, i'm losing the package. Or at least I think so.
Has anyone seen this before? Is there a better way to do this? How can I prevent packet loss when switching between more than two actions? Thanks!
Edit:
Edit: Here is the error code when 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