Intent and Parcelable object Android

前端 未结 5 712
刺人心
刺人心 2021-02-09 07:44

Why do I need to parcel my object even if I just need to send it to another thread of the same task? Actually I need to open an activity that will run even on the same thread (t

5条回答
  •  渐次进展
    2021-02-09 08:06

    All Activities, you create run only on the UI thread. There is no other way. With regards to your question about the need to parcel your objects, actually it is not the only way. You can pass objects by making the objects implement the Serializable interface also.

    At a high level, Intents is asynchronous messaging mechanism for communicating between different components like: Activities, Services & Broadcast Receivers. The source & destination component may or may not part of the same application (hence process) and Android framework needs a standardized way of passing objects across processes if required.

提交回复
热议问题