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

mohamadreza azadi
mohamadreza azadi
5,167 Points

really need help parcle

hey guys when i tap on 7 days button this error give it to me i dont know why even i compare ben project to my project everything like together my project crash and ben did'nt here is my error :

07-01 21:01:44.604 17610-17610/teamtreehouse.com.stormy E/Parcel: Class not found when unmarshalling: java.lang.ClassNotFoundException: Invalid name: at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:324) at android.os.Parcel.readParcelableCreator(Parcel.java:2435) at android.os.Parcel.readParcelable(Parcel.java:2389) at android.os.Parcel.readParcelableArray(Parcel.java:2497) at android.os.Parcel.readValue(Parcel.java:2349) at android.os.Parcel.readArrayMapInternal(Parcel.java:2645) at android.os.BaseBundle.unparcel(BaseBundle.java:221) at android.os.Bundle.getParcelableArray(Bundle.java:809) at android.content.Intent.getParcelableArrayExtra(Intent.java:5391) at teamtreehouse.com.stormy.Ui.DailyForcast.onCreate(DailyForcast.java:25) at android.app.Activity.performCreate(Activity.java:6285) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524) at android.app.ActivityThread.access$900(ActivityThread.java:154) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:5526) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 07-01 21:01:44.605 17610-17610/teamtreehouse.com.stormy E/AndroidRuntime: FATAL EXCEPTION: main Process: teamtreehouse.com.stormy, PID: 17610 java.lang.RuntimeException: Unable to start activity ComponentInfo{teamtreehouse.com.stormy/teamtreehouse.com.stormy.Ui.DailyForcast}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2464) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524) at android.app.ActivityThread.access$900(ActivityThread.java:154) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:5526) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: at android.os.Parcel.readParcelableCreator(Parcel.java:2463) at android.os.Parcel.readParcelable(Parcel.java:2389) at android.os.Parcel.readParcelableArray(Parcel.java:2497) at android.os.Parcel.readValue(Parcel.java:2349) at android.os.Parcel.readArrayMapInternal(Parcel.java:2645) at android.os.BaseBundle.unparcel(BaseBundle.java:221) at android.os.Bundle.getParcelableArray(Bundle.java:809) at android.content.Intent.getParcelableArrayExtra(Intent.java:5391) at teamtreehouse.com.stormy.Ui.DailyForcast.onCreate(DailyForcast.java:25) at android.app.Activity.performCreate(Activity.java:6285) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)  at android.app.ActivityThread.access$900(ActivityThread.java:154)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:224)  at android.app.ActivityThread.main(ActivityThread.java:5526)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

i used debugging and found problem at this line

<code>Parcelable parcelable[] =intent.getParcelableArrayExtra(MainActivity.Daily_Forcast);</code>

and dont know why is'nt working for me plzz help me im stuck here :((((

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great and kudos on finding the line that's causing the problem. However, your line isn't exactly like Ben's. Remember, that just about everything in programming is case-sensitive. Here's Ben's line:

Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST);

Here's your line:

Parcelable parcelable[] =intent.getParcelableArrayExtra(MainActivity.Daily_Forcast);

Note the difference in the spelling and capitalization of "DAILY_FORECAST" with an "E". Try correcting the capitalization and spelling and see if this helps! Also, the brackets should come after the data type to indicate that you're holding an array of that type instead of after the variable name.

Let me know how it goes! :sparkles:

mohamadreza azadi
mohamadreza azadi
5,167 Points

another error shows to me :(

07-01 17:58:17.483 12895-12895/teamtreehouse.com.stormy E/AndroidRuntime: FATAL EXCEPTION: main Process: teamtreehouse.com.stormy, PID: 12895 java.lang.NullPointerException: Attempt to invoke virtual method 'teamtreehouse.com.stormy.Weather.Day[] teamtreehouse.com.stormy.Weather.Forcast.getDailyForecast()' on a null object reference at teamtreehouse.com.stormy.Ui.MainActivity.startDailyActivity(MainActivity.java:285) at teamtreehouse.com.stormy.Ui.MainActivity_ViewBinding$1.doClick(MainActivity_ViewBinding.java:46) at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) at android.view.View.performClick(View.java:5637) at android.view.View$PerformClick.run(View.java:22429) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) 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) 07-01 17:58:18.367 12895-12928/teamtreehouse.com.stormy I/MainActivity: From JSON: Asia/Tehran 07-01 17:58:28.728 12895-12929/teamtreehouse.com.stormy E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -19 07-01 17:58:28.728 12895-12929/teamtreehouse.com.stormy E/EGL_emulation: tid 12929: swapBuffers(531): error 0x300d (EGL_BAD_SURFACE) 07-01 17:58:28.728 12895-12929/teamtreehouse.com.stormy W/OpenGLRenderer: swapBuffers encountered EGL error 12301 on 0xa05feb60, halting rendering...

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Here's the line that's grabbing my attention:

teamtreehouse.com.stormy.Weather.Day[] teamtreehouse.com.stormy.Weather.Forcast.getDailyForecast()' on a null object 

Note the spelling of "Forcast" as opposed to "Forecast". You should have a "Forecast.java" file, but something tells me that you spelled it "Forcast.java". I would suggest going through all your code and looking for misspellings of "Forecast".

Correct spelling: Forecast

Hope this helps! :sparkles: