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) Lists with RecyclerViews Using a Layout Manager

Mateo Cuervo
Mateo Cuervo
2,511 Points

FATAL EXCEPTION: main java.lang.RuntimeException:

Tried implementing the solution in other questions changing labels, but didn't work.

I'm getting the following error log: 4724-14724/com.cooervo.sunnyrainy E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cooervo.sunnyrainy/com.cooervo.sunnyrainy.GUI.HourlyForecastActivity}: java.lang.ArrayStoreException: source[0] of type com.cooervo.sunnyrainy.model.Day cannot be stored in destination array of type com.cooervo.sunnyrainy.model.Hour[] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) at android.app.ActivityThread.access$600(ActivityThread.java:130) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) at android.os.Handler.dispatchMessage(Handler.java:99) 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.lang.ArrayStoreException: source[0] of type com.cooervo.sunnyrainy.model.Day cannot be stored in destination array of type com.cooervo.sunnyrainy.model.Hour[] at java.lang.System.arraycopy(Native Method) at java.util.Arrays.copyOfRange(Arrays.java:2943) at java.util.Arrays.copyOf(Arrays.java:2641) at com.cooervo.sunnyrainy.GUI.HourlyForecastActivity.onCreate(HourlyForecastActivity.java:32) at android.app.Activity.performCreate(Activity.java:5008) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)             at android.app.ActivityThread.access$600(ActivityThread.java:130)             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)             at android.os.Handler.dispatchMessage(Handler.java:99)             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)

My code at github: https://github.com/cooervo/sunnyrainy

1 Answer

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Hi Mateo,

It's very useful when you post your code on GitHub, so thanks for doing that!

It looks like your error could be coming from your MainActivity. In your startHourlyActivity() method you are using getDailyForecast instead of getHourlyForecast when you are adding data to your intent.

I hope this helps. If not, let me know.

Mateo Cuervo
Mateo Cuervo
2,511 Points

god bless you Jon that was the problem. Thanks again for your help!