Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Version used: 1.0.0-alpha11
Devices/Android versions reproduced on: irrelevant
<activity <== ACTIVITY AS DESTINATION
android:id="@+id/NewsDetailActivity"
android:name="co.bstorm.navtest.ui.news.newsdetail.NewsDetailActivity"
android:label="activity"
tools:layout="@layout/activity_news_detail">
<argument
android:name="model"
app:argType="co.bstorm.navtest.model.CustomModel[]" /> <== ARRAY OF PARCELABLES AS ARGTYPE
</activity>
When I use Activity as a destination, and have an argument argType as array of Parcelable custom model class, library crashes on destination inside safeArgs generated code when trying to extract the Parcelable array from Bundle:
2019-02-06 13:49:18.523 25348-25348/co.bstorm.navtest E/AndroidRuntime: FATAL EXCEPTION: main
Process: co.bstorm.navtest, PID: 25348
java.lang.RuntimeException: Unable to start activity ComponentInfo{co.bstorm.navtest/co.bstorm.navtest.ui.news.newsdetail.NewsDetailActivity}: java.lang.ClassCastException: android.os.Parcelable[] cannot be cast to co.bstorm.navtest.model.CustomModel[]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2793)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Caused by: java.lang.ClassCastException: android.os.Parcelable[] cannot be cast to co.bstorm.navtest.model.CustomModel[]
at co.bstorm.navtest.ui.news.newsdetail.NewsDetailActivityArgs$Companion.fromBundle(NewsDetailActivityArgs.kt:25)
at co.bstorm.navtest.ui.news.newsdetail.NewsDetailActivity.onCreate(NewsDetailActivity.kt:13)
at android.app.Activity.performCreate(Activity.java:6915)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
The exact same setup works properly with the only difference being a Fragment as the destination, instead of activity, which once again flags this as definitely a library bug, and not something on my side.
Sample project:
Instructions:
1. Run app
2. Click on Settings in the upper right
3. App crashes when the destination Activity tries to un-bundle the parcelable array.
There is also a commented out action for the Fragment destination with the same setup which works properly.