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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:25:51+00:00 2026-06-13T17:25:51+00:00

I’m occasionally seeing exceptions that I do not really understand. Here’s what I do:

  • 0

I’m occasionally seeing exceptions that I do not really understand. Here’s what I do: I have an interface

public interface IResultProcessor<T> extends Serializable {

    void processResult(T result);

}

, instances of which I use in this class:

public class ConfirmationDialogFragment extends DialogFragment {

    public static void executeAfterConfirmation(FragmentActivity activity, IResultProcessor<Void> runnable,
        String title, String message, int icon, String positiveButtonText, String negativeButtonText) {

        ConfirmationDialogFragment fragment = new ConfirmationDialogFragment();
        Bundle args = new Bundle();
        args.putSerializable(ARG_RUNNABLE, runnable);
        fragment.setArguments(args);
        fragment.show(activity.getSupportFragmentManager(), "dialog");
    }

}

In the onCreateDialog() method, I receive the IProcessResult instance and execute it if the user has confirmed.

I then use all this in an activity as follows:

@SuppressWarnings("serial") 
IResultProcessor<Void> processor = new IResultProcessor<Void>() {

    @Override
    public void processResult(Void result) {
        new AsyncTask<Void, Void, String>() {

            @Override
            protected String doInBackground(Void... params) {
                DBFacade.INSTANCE.saveSession(session);
                return "My msg...";
            }

            @Override
            protected void onPostExecute(String result) {
                Toast.makeText(MyActivity.this, result, Toast.LENGTH_LONG).show();
            }

        }.execute((Void) null);
    }
};
ConfirmationDialogFragment.executeAfterConfirmation(this, processor, "Save session?", "dialog text", R.drawable.ic_dialog_info, "Save", "Don't save");

The session object saved in the AsyncTask does not implement Serializable (but Parcelable because of other reasons) and is a field of MyActivity.

And here’s the exception I’m seeing:

java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = MyActivity$3)
    at android.os.Parcel.writeSerializable(Parcel.java:1279)
    at android.os.Parcel.writeValue(Parcel.java:1233)
    at android.os.Parcel.writeMapInternal(Parcel.java:591)
    at android.os.Bundle.writeToParcel(Bundle.java:1619)
    at android.os.Parcel.writeBundle(Parcel.java:605)
    at android.support.v4.app.FragmentState.writeToParcel(Fragment.java:132)
    at android.os.Parcel.writeTypedArray(Parcel.java:1102)
    at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:357)
    at android.os.Parcel.writeParcelable(Parcel.java:1254)
    at android.os.Parcel.writeValue(Parcel.java:1173)
    at android.os.Parcel.writeMapInternal(Parcel.java:591)
    at android.os.Bundle.writeToParcel(Bundle.java:1619)
    at android.os.Parcel.writeBundle(Parcel.java:605)
    at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2078)
    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:2874)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4745)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.NotSerializableException: MyActivity
    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364)
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
    at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
    at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
    at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
    at android.os.Parcel.writeSerializable(Parcel.java:1274)
    ... 23 more
java.io.NotSerializableException: MyActivity
    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364)
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
    at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
    at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
    at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
    at android.os.Parcel.writeSerializable(Parcel.java:1274)
    at android.os.Parcel.writeValue(Parcel.java:1233)
    at android.os.Parcel.writeMapInternal(Parcel.java:591)
    at android.os.Bundle.writeToParcel(Bundle.java:1619)
    at android.os.Parcel.writeBundle(Parcel.java:605)
    at android.support.v4.app.FragmentState.writeToParcel(Fragment.java:132)
    at android.os.Parcel.writeTypedArray(Parcel.java:1102)
    at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:357)
    at android.os.Parcel.writeParcelable(Parcel.java:1254)
    at android.os.Parcel.writeValue(Parcel.java:1173)
    at android.os.Parcel.writeMapInternal(Parcel.java:591)
    at android.os.Bundle.writeToParcel(Bundle.java:1619)
    at android.os.Parcel.writeBundle(Parcel.java:605)
    at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2078)
    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:2874)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4745)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    at dalvik.system.NativeStart.main(Native Method)

Any idea what’s going on here?

  • 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-13T17:25:53+00:00Added an answer on June 13, 2026 at 5:25 pm

    I haven’t totally understood, but apparently solved the issue. The exceptions were thrown when the activity was destroyed because another one came into the foreground. I solved it by converting the anonymous IResultProcessor class into a static inner class of my activity.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is

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.