Câu hỏi phỏng vấn Android
Câu hỏi

What is Parcelable in Android?

Câu trả lời

Parcelable is an Android-specific interface that allows objects to be serialized and deserialized efficiently for passing between Android components, such as activities, services, and fragments, via Intents or Bundles[1][2][3].

The key differences between Parcelable and Java's built-in Serializable interface are:

  • Parcelable uses a custom binary serialization format optimized for Android's IPC mechanism, making it faster and more efficient than Serializable[2][3].
  • Parcelable avoids using reflection, which can cause performance issues on Android[3].
  • Parcelable requires you to manually write the serialization and deserialization code by implementing the writeToParcel() and CREATOR methods[1][2].

To exclude a field from being parcelized, you can either:

  1. Exclude the field manually by not writing it to the Parcel in the `writeToPa...
middle

middle

Gợi ý câu hỏi phỏng vấn

middle

When to use Fragment s vs Activitie s?

senior

What is the difference between getContext() , getApplicationContext() , getBaseContext() , and this ?

senior

What are some difference between Parcelable and Serializable ?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào