Tag

ViewModel

1 views collected around this technical thread.

Sohu Tech Products
Sohu Tech Products
May 14, 2025 · Mobile Development

Best Practices for Reusing ViewModel Logic Across Multiple Android Screens

This article examines common challenges of sharing user interaction logic across multiple Android screens using ViewModel, compares four reuse strategies—including base class inheritance, helper classes, Kotlin class delegation, and interface default functions—and recommends the interface default‑function approach as the most flexible and maintainable solution.

AndroidKotlinMVI
0 likes · 14 min read
Best Practices for Reusing ViewModel Logic Across Multiple Android Screens
Airbnb Technology Team
Airbnb Technology Team
Nov 25, 2024 · Mobile Development

Using Trio for Navigation in Android Jetpack Compose

The article shows how Trio stores navigation state in a ViewModel‑backed stack, uses type‑safe routers for screen and activity transitions, supports async save‑and‑exit, result‑returning navigation, and interoperates with legacy fragments, enabling modular, testable navigation in Jetpack Compose.

AndroidJetpack ComposeMavericks
0 likes · 14 min read
Using Trio for Navigation in Android Jetpack Compose
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Aug 28, 2024 · Mobile Development

Implementing MVVM with Riverpod in Flutter: A ViewModel‑Based State Management Guide

This article explains how to introduce the ViewModel concept into a Flutter project and use Riverpod 2.0’s NotifierProvider to achieve a clean separation of UI and business logic, illustrated with a complete login‑page example and reusable code snippets.

DartFlutterMVVM
0 likes · 12 min read
Implementing MVVM with Riverpod in Flutter: A ViewModel‑Based State Management Guide
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Jun 27, 2024 · Mobile Development

State Management in Jetpack Compose: remember, MutableState, ViewModel, StateFlow, LiveData, and Effect APIs

Jetpack Compose’s state management techniques—including remember, mutableStateOf, ViewModel integration, StateFlow, LiveData, state lifting, and various side‑effect APIs such as LaunchedEffect, rememberCoroutineScope, and DisposableEffect—are explained with Kotlin code examples to help Android developers build robust, reactive UI components.

AndroidEffect APIJetpack Compose
0 likes · 15 min read
State Management in Jetpack Compose: remember, MutableState, ViewModel, StateFlow, LiveData, and Effect APIs
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
May 22, 2024 · Mobile Development

Android MVVM Architecture

This article explains the MVVM (Model-View-ViewModel) architecture for modern Android development, detailing its three core components, their responsibilities, and provides a step‑by‑step example with Jetpack components, including LiveData, ViewModel, View Binding, and complete code snippets to build a simple user list UI.

AndroidJavaKotlin
0 likes · 8 min read
Android MVVM Architecture
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
May 14, 2024 · Mobile Development

Implementing ViewModel with Riverpod in Flutter for UI‑Logic Separation

This article introduces the ViewModel concept and demonstrates how to use Riverpod 2.0's NotifierProvider in Flutter to separate UI from business logic, providing step‑by‑step code examples, including model, ViewModel, view, and a complete login page implementation.

FlutterMVVMMobile Development
0 likes · 13 min read
Implementing ViewModel with Riverpod in Flutter for UI‑Logic Separation
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Dec 5, 2023 · Mobile Development

Understanding Android ViewModel: State Preservation, onRetainNonConfigurationInstance, and Implementation Details

This article explains how Android ViewModel preserves UI state across configuration changes, the role of SavedStateHandle and onRetainNonConfigurationInstance, the internal mechanisms involving ComponentActivity and ViewModelStore, and provides practical guidance on using factories, CreationExtras, and Hilt for custom ViewModel implementations.

AndroidJetpackLifecycle
0 likes · 22 min read
Understanding Android ViewModel: State Preservation, onRetainNonConfigurationInstance, and Implementation Details
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Oct 23, 2023 · Mobile Development

Building a Kotlin Retrofit Network Request Framework for Android with Token Interceptors, File Upload/Download, and ViewModel Integration

This article demonstrates how to create a clean, reusable network request layer for Android using Kotlin, Retrofit, and OkHttp, covering dependency setup, custom token interceptors, Retrofit utility creation, request/result handling with ViewModel extensions, and comprehensive file upload and download implementations.

AndroidFile UploadKotlin
0 likes · 17 min read
Building a Kotlin Retrofit Network Request Framework for Android with Token Interceptors, File Upload/Download, and ViewModel Integration
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Nov 18, 2022 · Mobile Development

Implementing Edit Functionality and Component Reuse in a SwiftUI LinkWorld App

This article walks through the design and implementation of an edit screen for the LinkWorld iOS app, showing how to refactor shared UI parts into reusable SwiftUI components, bind them to a data model, and handle navigation, modal presentation, and update logic using a view‑model.

Component ReuseEdit ViewMobile Development
0 likes · 13 min read
Implementing Edit Functionality and Component Reuse in a SwiftUI LinkWorld App
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Nov 17, 2022 · Mobile Development

Implementing MVVM Architecture and Network Requests in a SwiftUI Mobile App

This tutorial walks through building a minimal MVP for the Linkworld iOS app by applying the MVVM pattern, creating a ViewModel, fetching JSON data with URLSession, and adding, editing, and deleting identity cards using SwiftUI state management and context menus.

JSONMVVMNetworking
0 likes · 11 min read
Implementing MVVM Architecture and Network Requests in a SwiftUI Mobile App
Bilibili Tech
Bilibili Tech
Oct 25, 2022 · Mobile Development

Architecture and Data Flow of Bilibili Live Room: MVVM Design, View Interaction, and Business Segmentation

The article dissects Bilibili’s live‑room architecture, showing how dozens of independent MVVM‑based Views act as business units, explains the coupling problems caused by improper LiveData and cross‑ViewModel references, outlines a service‑driven data‑flow and zone‑based lifecycle model, and proposes systematic refactoring to reduce technical debt and foster shared architectural ownership.

Data FlowLive StreamingMVVM
0 likes · 13 min read
Architecture and Data Flow of Bilibili Live Room: MVVM Design, View Interaction, and Business Segmentation
IEG Growth Platform Technology Team
IEG Growth Platform Technology Team
Sep 15, 2022 · Mobile Development

Understanding and Implementing MVI Architecture in Android Applications

This article introduces Google's recommended MVI (Model-View-Intent) architecture for Android, compares it with MVVM, explains the benefits of unidirectional data flow, and provides practical Kotlin implementations—including LiveData state handling, single-event management, and step-by-step code examples—to guide developers in adopting MVI in mobile projects.

AndroidKotlinLiveData
0 likes · 16 min read
Understanding and Implementing MVI Architecture in Android Applications
Airbnb Technology Team
Airbnb Technology Team
Dec 22, 2021 · Mobile Development

Automated Unit Testing Framework for Android ViewModel (Part 4)

Part 4 of Airbnb’s Android testing series presents a dedicated framework that lets developers write concise, single‑function unit tests for ViewModel classes by specifying initial state, parameters, and expected state or dependency calls through a Kotlin DSL, integrating with JUnit, Robolectric, Mockito, and offering scaffolding and IntelliJ plugins for streamlined, systematic ViewModel logic verification.

AndroidDSLKotlin
0 likes · 12 min read
Automated Unit Testing Framework for Android ViewModel (Part 4)
Sohu Tech Products
Sohu Tech Products
Aug 11, 2021 · Mobile Development

Encapsulating Retrofit with Kotlin Coroutines in Android MVVM Architecture

This article explains how to integrate Retrofit with Kotlin coroutines following Google’s Android architecture guidelines, covering coroutine basics, OkHttp and Retrofit setup, generic response handling, repository abstraction, ViewModel usage, and lifecycle‑aware coroutine scopes to achieve clean, asynchronous network calls.

AndroidKotlin CoroutinesLiveData
0 likes · 13 min read
Encapsulating Retrofit with Kotlin Coroutines in Android MVVM Architecture
Sohu Tech Products
Sohu Tech Products
Mar 3, 2021 · Mobile Development

Understanding Android Jetpack ViewModel: Concepts, Usage, and Source Code Analysis

This article explains the purpose and characteristics of Android Jetpack's ViewModel component, demonstrates how to use it with LiveData in Activities and Fragments, shows code examples for data sharing between fragments, and provides an in‑depth analysis of its internal source code and lifecycle handling.

AndroidJetpackLiveData
0 likes · 21 min read
Understanding Android Jetpack ViewModel: Concepts, Usage, and Source Code Analysis
Ctrip Technology
Ctrip Technology
Sep 17, 2020 · Mobile Development

Applying Divide‑and‑Conquer and Jetpack Architecture to Decouple Complex Payment Flows in Android

The article describes how a Ctrip senior Android engineer uses divide‑and‑conquer, MVP with Clean Architecture, and Jetpack components such as LiveData and ViewModel to break down a highly coupled payment module into reusable view components, improve data flow, and simplify testing and maintenance.

AndroidLiveDataMobile Development
0 likes · 10 min read
Applying Divide‑and‑Conquer and Jetpack Architecture to Decouple Complex Payment Flows in Android
JD Retail Technology
JD Retail Technology
Aug 10, 2020 · Mobile Development

Source Code Analysis of Android Lifecycle, LiveData, and ViewModel

This article provides a detailed source‑code analysis of Android Jetpack’s Lifecycle, LiveData, and ViewModel components, explaining their architecture, usage examples, internal mechanisms, and offering practical techniques such as bottom‑up and top‑down analysis, code navigation tips, and unit‑test strategies for developers.

AndroidLifecycleLiveData
0 likes · 38 min read
Source Code Analysis of Android Lifecycle, LiveData, and ViewModel
Watermelon Video Tech Team
Watermelon Video Tech Team
Nov 29, 2019 · Mobile Development

Scene: ByteDance’s Open‑Source Android Single‑Activity Navigation and Composition Framework

Scene is an open‑source Android framework from ByteDance’s Xigua video team that provides lightweight, view‑based page navigation and composition for Single‑Activity applications, addressing Activity/Fragment limitations with flexible stack management, shared‑element animations, and ViewModel‑based communication.

AndroidFragmentScene
0 likes · 14 min read
Scene: ByteDance’s Open‑Source Android Single‑Activity Navigation and Composition Framework
Xianyu Technology
Xianyu Technology
Oct 30, 2019 · Frontend Development

Improving Front-End Development Efficiency with Serverless ViewModel Architecture

By relocating the ViewModel layer to a serverless backend, developers can implement a single, reusable ViewModel as FaaS functions that serve web, native, and mini‑program front‑ends, dramatically cutting duplication, maintenance costs, and development effort while simplifying updates across all platforms.

EfficiencyFaaSViewModel
0 likes · 6 min read
Improving Front-End Development Efficiency with Serverless ViewModel Architecture
JD Retail Technology
JD Retail Technology
Jun 15, 2018 · Mobile Development

Practical Guide to Android Architecture Components: Lifecycles, LiveData, and ViewModel Integration

This article introduces Google’s Android Architecture Components—Lifecycle, LiveData, ViewModel, and Room—explaining their principles, how they simplify lifecycle management and data handling, and provides practical integration techniques and best‑practice guidelines for mobile developers.

AndroidArchitecture ComponentsLifecycle
0 likes · 10 min read
Practical Guide to Android Architecture Components: Lifecycles, LiveData, and ViewModel Integration