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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:15:33+00:00 2026-06-03T22:15:33+00:00

I have a class named AllStatStruct. This class contains three attributes, which are objects

  • 0

I have a class named AllStatStruct. This class contains three attributes, which are objects of my classes StatStructCycle, StatStructHistory and MatrixStruct. Every class extends the class DataStruct and implements the Parcelable interface. In the implementation of the interface, every class is read and written by using readParceable() or writeParceable().

In my Activity, I call a SOAP webservice in an AsyncTask and get an object of the class AllStatStruct. This object is passed to the next Activity by creating a Bundle:

protected void onPostExecute(final AllStatStruct ass) {

    if (ass != null) {
        if (dialog.isShowing()) {
            dialog.dismiss();
        }

        Bundle bundle = new Bundle();
        bundle.putParcelable("allStatStruct", ass);
        intent = new Intent(packageContext, PrivateView.class);
        intent.putExtras(bundle);
        startActivity(intent);

    } else {
        KreativBarometerMainView.this.showDialog(9999);
    }
}

Marshalling the parcel works well, as I can see at my trace outputs in the LogCat. But when unmarshalling the parcel, a ClassNotFoundException occurs and I have no idea why. This is the trace:

05-11 15:02:59.796: E/AndroidRuntime(8647): Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: 
05-11 15:02:59.796: E/AndroidRuntime(8647):     at android.os.Parcel.readParcelable(Parcel.java:1958)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at de.kreativBarometer.net.structs.AllStatStruct.<init>(AllStatStruct.java:45)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at de.kreativBarometer.net.structs.AllStatStruct$1.createFromParcel(AllStatStruct.java:70)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at de.kreativBarometer.net.structs.AllStatStruct$1.createFromParcel(AllStatStruct.java:1)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at android.os.Parcel.readParcelable(Parcel.java:1981)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at android.os.Parcel.readValue(Parcel.java:1846)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at android.os.Parcel.readMapInternal(Parcel.java:2083)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at android.os.Bundle.unparcel(Bundle.java:208)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at android.os.Bundle.getParcelable(Bundle.java:1100)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at de.kreativBarometer.ui.PrivateView.onCreate(PrivateView.java:693)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-11 15:02:59.796: E/AndroidRuntime(8647):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1628)
05-11 15:02:59.796: E/AndroidRuntime(8647):     ... 11 more

As you can see, there is no name given for the not found class! So it is searching for a class named “” and of course it is not found.

I have no idea, why this occurs. Can someone help me? I already tried to play around with the ClassLoader, but giving the intent an extra classloader and using this one to unmarshall the parcelables does not work.

EDIT:

As you suggested, I tried to pass the several parts of the AllStatStruct seperately. It works fine with the StatStructCycle and the MatrixStruct, but with the StatStructHistory, there is still an error thrown.

Now, I get a NullPointerException, when I try to unmarshall my ArrayList with StatStructCycles in it. I commented out the other parts of the history.

I tried to write and read the ArrayList with writeTypedList(List<T> list) and readTypedList(List<T> list, Creator<T> c), but it is not working either.

As I am using ArrayLists, I also trimmed their capacity to their real size by using trimToSize(), because I thought the “empty” slots of the ArrayList could cause the problem. But again, this is not the case…

Starting the App with the debugger shows, that the marshalled StatStructHistory has no empty values… every attribute or listitem is initialized. I have no idea where this NullPointerException is coming from.

best regards
htz

  • 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-03T22:15:34+00:00Added an answer on June 3, 2026 at 10:15 pm

    Problem unmarshalling parcelables

    Looks like even if your marshalling is successful, the unmarshall process can still fail if there are null exceptions.

    For debugging purposes, try marshalling each one of your sub-objects one by one. See if any of them error out, then dig into the problem. Right now you’re trying to unmarhsall 3 objects at once and it’s hard to pin point which one is having an issue (if any).

    If it’s not clear, I’m suggesting trying this:

    bundle.putParcelable("allStatStruct", ass.StatStructCycle); 
    

    If that works, try:

    bundle.putParcelable("allStatStruct", ass.StatStructHistory); 
    

    etc…

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

Sidebar

Related Questions

I have an class named Foo. This class contains a collection of child objects
I have a class named Employee.This class have 3 attributes:name,adress and supervisor.
I have a class named Packet with this destruct: class Packet { ... RequestPtr
I have a class named Page with a private property currently called _pageData which
I have a class named baseClass. From this class I inherit a class names
I have a Class named Constants that contains all the constant variable in my
I have a class named Person and in this class is the property PersonName
I have a class named toto which I send to a function that does
I have a class named InvoiceLine which has the following properties. public class InvoiceLine
I have a class named Graph, in this class I have a member named

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.