Using Parcel to clone an object?

后端 未结 3 1303
猫巷女王i
猫巷女王i 2021-02-06 10:09

I have a class which has implemented Parcelable. Can I do something like the following to create a new instance of a class?:

Foo foo = new Foo(\"a\", \"b\", \"c\         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-06 10:24

    Yes, assuming that your parcel implementation correctly writes and reads all of the variables in Foo, that should create a clone.

提交回复
热议问题