how to pass objects between intents

前端 未结 4 1935
暗喜
暗喜 2021-01-23 09:42

I have a class that contains data i want to pass it between intents, this class have arraylist that contains another class objects. this is my class

    public          


        
4条回答
  •  天涯浪人
    2021-01-23 10:08

    This may be your problem:

    Classes implementing the Parcelable interface must also have a static field called CREATOR, which is an object implementing the Parcelable.Creator interface.

    Alternatively, I'd try to have Item implement Parcelable, as well.

    The fail-safe alternative is to write your data structure into a JSON string, which also allows you to pass the data to other applications that don't have access to your ParsedData class.

提交回复
热议问题