How to send an object from one Android Activity to another using Intents?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Passing data from one Android activity to another is usually done with intent extras. For simple values that means strings and primitives, and for custom models the normal Android choice is Parcelable, because it is designed for Android component communication and is a better fit than falling back to general Java serialization.
Make the Model Parcelable
In Kotlin, @Parcelize keeps Parcelable practical enough for routine screen-to-screen data transfer.
This is the standard approach for small, screen-specific payloads. It avoids the manual writeToParcel boilerplate that older Android examples often show.
Put the Object into the Intent
The sending activity should use a shared key constant and call putExtra.
Centralizing the key matters. A large fraction of intent bugs are not parceling bugs at all; they are mismatched extra names between sender and receiver.
Read It Back Safely in the Destination Activity
Modern Android provides a type-safer retrieval API on newer platform versions, and AndroidX also offers IntentCompat helpers for compatibility across API levels.
Reading extras defensively is important because activities can be launched from tests, notifications, deep links, or process recreation paths where the expected extra may be absent.
Passing Lists of Objects
If you need multiple models, putParcelableArrayListExtra is the usual choice.
And in the receiving activity:
This is fine for small collections. It is not the right transport for large graphs of state.
Pass an ID Instead of a Large Object
Android's own guidance on parcelables and bundles warns about oversized extras. Large payloads can trigger TransactionTooLargeException, and even smaller payloads become awkward when the same object is already stored in a database or repository.
Then let the destination screen load the full object from Room, a repository, or a ViewModel. This is usually more robust than shipping a large object through the intent boundary.
Return an Updated Object with the Activity Result API
If the second activity edits the object and returns a result, use the Activity Result API rather than older callback patterns.
This keeps navigation contracts explicit and easier to maintain.
Common Pitfalls
- Using different extra keys in the sender and receiver.
- Reading extras without null checks in the destination activity.
- Passing large or shared object graphs instead of passing an identifier and reloading data.
- Using older unsafe parcelable retrieval methods when type-safe alternatives are available.
- Forgetting that changing a parcelable model means retesting every screen contract that uses it.
Summary
- Use intent extras for small, screen-specific data passed between activities.
- Prefer
Parcelablefor custom Android models, especially with Kotlin@Parcelize. - Use type-safe parcelable retrieval APIs such as
IntentCompat.getParcelableExtra. - Pass IDs instead of large objects when the payload is big or already stored elsewhere.
- Handle extras defensively because activities can be launched through many entry points.

