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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:06:31+00:00 2026-05-31T08:06:31+00:00

I am trying to restore my application from a Parcel (saved in a Bundle).

  • 0

I am trying to restore my application from a Parcel (saved in a Bundle).

My Activity uses OpenGL so it creates this surface view and calls these functions when it is saving or restoring the app.

class MySurfaceView extends GLSurfaceView {
    /* Lots of other stuff */
    public void onRestoreInstanceState(Bundle inState) {
        Log.d("Wormhole", "Restoring instance state");
        mRenderer.onRestoreInstanceState(inState);
    }

    public void onSaveInstanceState(Bundle outState) {
        Log.d("Wormhole", "Saving instance state");
        mRenderer.onSaveInstanceState(outState);
    }
}

in mRenderer

public void onRestoreInstanceState(Bundle inState){
    mFlowManager = inState.getParcelable("flowmanager");
}

public void onSaveInstanceState (Bundle outState){
    outState.putParcelable("flowmanager", mFlowManager);
}

in mFlowManager

public class FlowManager implements Touchable, Parcelable {
private enum State {
    SPLASH, MENU, GAME_SINGLE, GAME_MULTI
};

private Connection mConnection;
private ScoreDataSource mScoreDataSource;
private GameEngine mGameEngine;
private SplashScreen mSplash;
private MainMenu mMenu;
private State mState = State.SPLASH;
private long mTime;
private int mVersionID;

/* Other stuff */

@Override
public int describeContents() {
    return 0;
}

@Override
public void writeToParcel(Parcel out, int flags) {
    out.writeString(mState.name());
    out.writeParcelable(mSplash, 0);
    out.writeParcelable(mMenu, 0);
}

public static final Parcelable.Creator<FlowManager> CREATOR = new Parcelable.Creator<FlowManager>() {
    public FlowManager createFromParcel(Parcel in) {
        return new FlowManager(in);
    }

    public FlowManager[] newArray(int size) {
        return new FlowManager[size];
    }
};

private FlowManager(Parcel in) {
    mConnection = new Connection();

    mState = State.valueOf(in.readString());
    mSplash = in.readParcelable(null); // Exception occurs here
    mMenu = in.readParcelable(null);
}

}

The FlowManager class has instances of other classes that need to be saved. Those classes I made Parselable and it’s when restoring them I get the error.

I’ve seen posts about this error but they all were for sending data between apps and having to use a different ClassLoader. This is all the same app. Do I need to set my ClassLoader because this is in a GLSurfaceView? How do I find the ClassLoader I need?

  • 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-31T08:06:32+00:00Added an answer on May 31, 2026 at 8:06 am

    update your FlowManager(Parcel in) as below:

    private FlowManager(Parcel in) {
        mConnection = new Connection();
    
        mState = State.valueOf(in.readString());
        mSplash = in.readParcelable(SplashScreen.class.getClassLoader());
        mMenu = in.readParcelable(MainMenu.class.getClassLoader());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to open windows 7 help from a .Net form application to
I'm trying to call a native function from a managed assembly. I've done this
I'm trying to bind to some XML data from my WPF application. I've set
I'm trying to perform some offline maintenance (dev database restore from live backup) on
We are trying to save the state of the application on exit and restore
I am trying to use SMO in a Windows Forms application to restore a
I am trying to restore a database from one environment to another. I backed
I am trying to restore a database by first restoring a full backup and
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,

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.