Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Safe-args: Passing an object from an imported package. Possible?

I’m trying to pass a Track object from the GPX Parser package that I’ve imported.

This is my navigation xml:

<argument
        android:name="track_to_pass"
        app:argType="io.ticofab.androidgpxparser.parser.domain.Track" />

I’m getting runtime exception:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mypackage.myapp/com.mypackage.myapp.MainActivity}: android.view.InflateException: Binary XML file line #10 in com.mypackage.myapp:layout/activity_main: Binary XML file line #10 in com.mypackage.myapp:layout/activity_main: Error inflating class androidx.fragment.app.FragmentContainerView

Can I pass it in any way to another fragment?

>Solution :

I’m getting runtime exception

There should be much more to the stack trace than that.

Safe-args: Passing an object from an imported package. Possible?

As Ian notes in a comment, that will only be possible if the class implements
Parcelable or Serializable. Presently, Track does not. You might file a feature request for Track and related types to be made Parcelable.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading