Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Lists and Adapters (2015) Using Parcelable Data Retrieving Parcelable Data

Tomasz Bagiński
Tomasz Bagiński
3,153 Points

WeatherApp -> click on "daily button" -> app crash ( "Class not found when unmarshalling: Europe/Warsaw" )

Hi

:/ i added '''text''' and it don't work - sorry for this inconvenience

Can you help me with this strange for me error in code ?:)

When I clicked daily button I cached this Exception:

E/Parcel: Class not found when unmarshalling: Europe/Warsaw java.lang.ClassNotFoundException: Invalid name: Europe/Warsaw

from stacktrace : com.example.tomas.weatherapp.ui.DailyForecastActivity.onCreate(DailyForecastActivity.java:39) it's: ''' 39: Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST); '''

09-18 12:38:02.656 4823-4823/com.example.tomas.weatherapp E/Parcel: Class not found when unmarshalling: Europe/Warsaw java.lang.ClassNotFoundException: Invalid name: Europe/Warsaw at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:400) at android.os.Parcel.readParcelableCreator(Parcel.java:2508) at android.os.Parcel.readParcelable(Parcel.java:2462) at android.os.Parcel.readParcelableArray(Parcel.java:2570) at android.os.Parcel.readValue(Parcel.java:2419) at android.os.Parcel.readArrayMapInternal(Parcel.java:2732) at android.os.BaseBundle.unparcel(BaseBundle.java:269) at android.os.Bundle.getParcelableArray(Bundle.java:887) at android.content.Intent.getParcelableArrayExtra(Intent.java:6285) at com.example.tomas.weatherapp.ui.DailyForecastActivity.onCreate(DailyForecastActivity.java:39) at android.app.Activity.performCreate(Activity.java:6679) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Tomasz Bagiński
Tomasz Bagiński
3,153 Points

HALF SOLVE

I forgot to write this line in Day.java: mIcon = in.readString();

public void writeToParcel(Parcel parcel, int i) {
parcel.writeLong(mTime);
parcel.writeString(mSummary);
parcel.writeDouble(mTeperatureMax);
parcel.writeString(mIcon);
parcel.writeString(mTimeZone);
}

must be the same order :

public Day(Parcel in) {
    mTime = in.readLong();
    mSummary = in.readString();
    mTeperatureMax = in.readDouble();
    mIcon = in.readString();
    mTimeZone = in.readString();
}

2 Answers

Can you upload your project on github, so i can check it?

Tomasz Bagiński
Tomasz Bagiński
3,153 Points

Tarek thank you for your reply but I don't know how I fixed this problem :) [ answer is above ]

daniel davis
daniel davis
7,572 Points

Wow that fixed my null pointer exception as well. Thanks!