Android MVI vs MVVM: state and events in practice
MVVM and MVI overlap in modern Android applications. Both can expose immutable state through StateFlow. The practical distinction is whether actions and transitions are modeled explicitly as intents and reducers, or as methods on a ViewModel.
How the pieces connect
A starting folder structure
presentation/checkout/
CheckoutScreen.kt
CheckoutViewModel.kt
CheckoutState.kt
CheckoutIntent.kt # explicit action model
CheckoutEffect.kt # transient UI communicationUse explicit intents when transitions get complex
A checkout flow with address changes, coupon validation, and payment retries benefits from a finite action vocabulary. A reducer makes transitions reviewable and testable. A static settings screen with two actions may be clearer with named ViewModel methods.
State and effects solve different problems
State describes what should render now. A transient notification or navigation request may be an effect. Decide what happens when the screen is stopped: a channel can queue events, while a shared flow can drop them without subscribers. For critical outcomes, represent the result in durable state and acknowledge it explicitly.
Do not let reducers perform network I/O
A pure reducer takes state and an action and returns state. The ViewModel or an effect handler performs asynchronous work, then dispatches a result. Test transition logic separately from repositories. Avoid reducers that mutate shared collections in place.
Choose the smallest consistent vocabulary
MVI adds ceremony that pays off in complex workflows and debugging. MVVM with immutable state is often sufficient for ordinary screens. The generator provides a practical MVI intent/state/effect starting point, not a full event-sourcing framework.
Try this configuration
MVI · Jetpack Compose · StateFlow · Retrofit
The generator includes a working counter example with a repository contract, selected dependencies, navigation, and local setup instructions. Extend the example around your own domain before shipping.
Configure your Android project →Continue reading
Primary references
See Android architecture recommendations and ViewModel documentation for platform guidance and lifecycle behavior.