Passer au contenu principal
Android Developers
Essentials
  • Build AI experiences
  • Build AI-powered Android apps with Gemini APIs and more.
  • Get started
  • Get started
  • Start by creating your first app. Go deeper with our training courses or explore app development on your own.
  • Hello world
  • Training courses
  • Tutorials
  • Compose for teams
  • Kotlin for Android
  • Monetization with Play ↗️
  • Extend by device
  • Build apps that give your users seamless experiences from phones to tablets, watches, headsets, and more.
  • Adaptive apps
  • Android XR
  • Wear OS
  • Android for Cars
  • Android TV
  • ChromeOS
  • Build by category
  • Learn to build for your use case by following Google's prescriptive and opinionated guidance.
  • Games
  • Camera & media
  • Social & messaging
  • Health & fitness
  • Productivity
  • Enterprise apps
  • Get the latest
  • Stay in touch with the latest releases throughout the year, join our preview programs, and give us your feedback.
  • Latest updates
  • Experimental updates
  • Android Studio preview
  • Jetpack & Compose libraries
  • Wear OS releases
  • Privacy Sandbox ↗️
Design & Plan
  • Excellent Experiences
  • Build the best experiences for your best users.
  • Learn more
  • UI Design
  • Design a beautiful user interface using Android best practices.
  • Design for Android
  • Mobile
  • Adaptive UI
  • Android XR
  • Widgets
  • Wear OS
  • Android TV
  • Architecture
  • Design robust, testable, and maintainable app logic and services.
  • Introduction
  • Libraries
  • Navigation
  • Modularization
  • Testing
  • Quality
  • Plan for app quality and align with Play store guidelines.
  • Overview
  • Core value
  • User experience
  • Accessibility
  • Technical quality
  • Excellent Experiences
  • Security
  • Safeguard users against threats and ensure a secure Android experience.
  • Overview
  • Privacy
  • Permissions
  • Identity
  • Fraud prevention
Develop
  • Gemini in Android Studio
  • Your AI development companion for Android development.
  • Learn more
  • Get Android Studio
  • Core areas
  • Get the samples and docs for the features you need.
  • Samples
  • User interfaces
  • Background work
  • Data and files
  • Connectivity
  • All core areas ⤵️
  • Tools and workflow
  • Use the IDE to write and build your app, or create your own pipeline.
  • Write and debug code
  • Build projects
  • Test your app
  • Performance
  • Command-line tools
  • Gradle plugin API
  • Device tech
  • Write code for form factors. Connect devices and share data.
  • Adaptive UI
  • Wear OS
  • Android XR
  • Android Health
  • Android for Cars
  • Android TV
  • All devices ⤵️
  • Libraries
  • Browse API reference documentation with all the details.
  • Android platform
  • Jetpack libraries
  • Compose libraries
  • Google Play services ↗️
  • Google Play SDK index ↗️
Google Play Community
/
  • English
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Polski
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어
Android Studio
  • App architecture
Android Developers
  • Essentials
    • Plus
  • Design & Plan
    • Plus
  • Develop
    • Plus
  • Google Play
  • Community
  • Android Studio
  • Introduction
  • Guide to app architecture
    • About app architecture
    • Architecture recommendations
    • Learning pathway ⍈
    • App fundamentals
    • UI layer libraries
      • About the UI layer
      • UI events
      • State holders and UI state
      • State production
      • View binding
        • About view binding
        • Migrate from Kotlin synthetics to view binding
      • Data binding library
        • About data binding
        • Get started
        • Layouts and binding expressions
        • Work with observable data objects
        • Generated binding classes
        • Binding adapters
        • Bind layout views to Architecture Components
        • Two-way data binding
      • Lifecycle-aware components
        • Lifecycles
          • Handle lifecycles
          • Integrate with Compose
        • ViewModel
          • About ViewModel
          • Create ViewModels with dependencies
          • ViewModel Scoping APIs
          • Saved State module for ViewModel
          • ViewModel APIs cheat sheet
        • LiveData
        • Save UI states
        • Use Kotlin coroutines with lifecycle-aware components
      • Paging Library
        • About paging
        • Load and display paged data
        • Page from network and database
        • Transform data streams
        • Manage and present loading states
        • Test your Paging implementation
        • Migrate to Paging 3
        • Paging 2
          • About Paging 2
          • Display paged lists
          • Load paged data
    • Domain layer
    • Data layer libraries
      • About the data layer
      • Offline first
      • DataStore
      • WorkManager
        • Schedule tasks with WorkManager
        • Get started with persistent work ⍈
    • App startup
  • Modularization
    • About modularization
    • Common patterns
  • App resources
    • About app resources
    • Handle configuration changes
    • Localization
      • Localize your app
      • Test your app with pseudolocales
      • Unicode and internationalization support
      • Language and locale resolution
      • Per-app language preferences
    • Complex XML resources
    • Resource types
      • About resource types
      • Animation
      • Color state list
      • Drawable
      • Layout
      • Menu
      • String
      • Style
      • Font
      • More types
  • App manifest file
    • About app manifests
    • <action>
    • <activity>
    • <activity-alias>
    • <application>
    • <attribution>
    • <category>
    • <compatible-screens>
    • <data>
    • <grant-uri-permission>
    • <instrumentation>
    • <intent-filter>
    • <layout>
    • <manifest>
    • <meta-data>
    • <path-permission>
    • <permission>
    • <permission-group>
    • <permission-tree>
    • <profileable>
    • <property>
    • <provider>
    • <queries>
    • <receiver>
    • <service>
    • <supports-gl-texture>
    • <supports-screens>
    • <uri-relative-filter-group>
    • <uses-configuration>
    • <uses-feature>
    • <uses-library>
    • <uses-native-library>
    • <uses-permission>
    • <uses-permission-sdk-23>
    • <uses-sdk>
  • App entry points
    • Activities
      • Introduction to activities
      • The activity lifecycle
      • Activity state changes
      • Test your app's activities
      • Tasks and the back stack
      • Processes and app lifecycle
      • Parcelables and bundles
      • Loaders
      • Recents screen
      • Restrictions on starting activities from the background
    • Add app shortcuts ⍈
  • App navigation
    • Principles of navigation
    • Navigation component
      • Overview
      • Navigation controller
      • Design your navigation graph
        • Overview
        • Dialog destinations
        • Activity destinations
        • Nested graphs
        • Deep links
        • New destination types
        • Type safety
        • Encapsulate your code
        • Global actions
        • Fragments and the Kotlin DSL
        • Use the Navigation editor
      • Use your navigation graph
        • Navigate to a destination
        • Navigate with options
        • Safe args
        • Pass data between destinations
        • Animate transitions between destinations
        • Conditional navigation
        • Interact programmatically with the Navigation component
      • The back stack
        • Overview
        • Dialogs and the back stack
        • Circular navigation and the back stack
        • Multiple back stacks
      • Integrations
        • Navigate with feature modules
        • Multi-module projects
        • Connect UI components to NavController
      • Migrate to the Navigation component
      • Test navigation
    • Custom back navigation
      • Custom back navigation
      • Predictive back gesture
      • Add support for predictive back animations
    • Responsive design
      • Handling configuration changes
      • Design for different form factors
    • Swipe between views
      • Swipe views using ViewPager2
      • Swipe views using ViewPager
    • Navigation 3
      • Overview
      • Get started
      • Understand and implement the basics
      • Save and manage navigation state
      • Create custom layouts using Scenes
      • Animate between destinations
    • Fragments
      • About fragments
      • Create a fragment
      • Fragment manager
      • Fragment transactions
      • Animate transitions between fragments
      • Fragment lifecycle
      • Saving state with fragments
      • Communicate with fragments
      • Working with the app bar
      • Displaying dialogs with DialogFragment
      • Debug your fragments
      • Test your fragments
    • App links
      • About app links
      • Enabling links to app content
      • Verify app links
      • Create app links for instant apps
    • Interact with other apps
      • About interacting with other apps
      • About intents and intent filters
      • About common intents
      • Google Maps intents for Android
      • Send users to another app
      • Get a result from an activity
      • Allow other apps to start your activity
      • Limit loading in on-device Android containers
      • Package visibility
        • About package visibility
        • Know which packages are visible automatically
        • Declare package visibility needs
        • Fulfill common use cases
        • Test package visibility
  • Dependency injection
    • About dependency injection
    • Manual dependency injection
    • Dependency injection with Hilt
    • Hilt in multi-module apps
    • Use Hilt with other Jetpack libraries
    • Hilt testing guide
    • Hilt and Dagger annotations cheat sheet
    • Dagger
      • Dagger basics
      • Using Dagger in Android apps
      • Using Dagger in multi-module apps
  • Build AI experiences
  • Get started
  • Get started
  • Hello world
  • Training courses
  • Tutorials
  • Compose for teams
  • Kotlin for Android
  • Monetization with Play ↗️
  • Extend by device
  • Adaptive apps
  • Android XR
  • Wear OS
  • Android for Cars
  • Android TV
  • ChromeOS
  • Build by category
  • Games
  • Camera & media
  • Social & messaging
  • Health & fitness
  • Productivity
  • Enterprise apps
  • Get the latest
  • Latest updates
  • Experimental updates
  • Android Studio preview
  • Jetpack & Compose libraries
  • Wear OS releases
  • Privacy Sandbox ↗️
  • Excellent Experiences
  • Learn more
  • UI Design
  • Design for Android
  • Mobile
  • Adaptive UI
  • Android XR
  • Widgets
  • Wear OS
  • Android TV
  • Architecture
  • Introduction
  • Libraries
  • Navigation
  • Modularization
  • Testing
  • Quality
  • Overview
  • Core value
  • User experience
  • Accessibility
  • Technical quality
  • Excellent Experiences
  • Security
  • Overview
  • Privacy
  • Permissions
  • Identity
  • Fraud prevention
  • Gemini in Android Studio
  • Learn more
  • Get Android Studio
  • Core areas
  • Samples
  • User interfaces
  • Background work
  • Data and files
  • Connectivity
  • All core areas ⤵️
  • Tools and workflow
  • Write and debug code
  • Build projects
  • Test your app
  • Performance
  • Command-line tools
  • Gradle plugin API
  • Device tech
  • Adaptive UI
  • Wear OS
  • Android XR
  • Android Health
  • Android for Cars
  • Android TV
  • All devices ⤵️
  • Libraries
  • Android platform
  • Jetpack libraries
  • Compose libraries
  • Google Play services ↗️
  • Google Play SDK index ↗️
Cette page a été traduite par l'API Cloud Translation.
  • Android Developers
  • Design & Plan
  • App architecture

Aide-mémoire sur les API ViewModel Inclus dans Android Jetpack.

Cet aide-mémoire vous permet de découvrir rapidement les différentes API ViewModel disponibles dans Jetpack, y compris l'artefact où elles se trouvent, le champ d'application de l'instance ViewModel renvoyée et un exemple d'utilisation.

Il peut également être téléchargé au format PDF.

API ViewModel disponibles dans Jetpack

Le contenu et les exemples de code de cette page sont soumis aux licences décrites dans la Licence de contenu. Java et OpenJDK sont des marques ou des marques déposées d'Oracle et/ou de ses sociétés affiliées.

Dernière mise à jour le 2025/02/10 (UTC).

  • WeChat WeChat
    Suivez Développeurs Android sur WeChat
  • X X
    Suivez @AndroidDev sur X
  • YouTube YouTube
    Retrouvez la chaîne Android Developers sur YouTube
  • En savoir plus sur Android

    • Android
    • Android pour les entreprises
    • Sécurité
    • Projet Android Open Source
    • Actualités
    • Blog
    • Podcasts
  • Découvrir

    • Jeux vidéo
    • Machine learning
    • Santé et remise en forme
    • Appareil photo et contenus multimédias
    • Règles de confidentialité
    • 5G
  • Appareils Android

    • Grands écrans
    • Wear OS
    • Appareils ChromeOS
    • Android for Cars
    • Android TV
  • Versions

    • Android 15
    • Android 14
    • Android 13
    • Android 12
    • Android 11
    • Android 10
    • Pie
  • Documentation et téléchargements

    • Guide Android Studio
    • Guides pour les développeurs
    • Document de référence sur les API
    • Télécharger Studio
    • Android NDK
  • Support

    • Signaler un bug de la plate-forme
    • Signaler un bug relatif à la documentation
    • Google Play support
    • Participer aux études sur l'expérience utilisateur
Google Developers
  • Android
  • Chrome
  • Firebase
  • Google Cloud Platform
  • Tous les produits
  • Règles de confidentialité
  • Licence
  • Consignes relatives à la marque
  • ICP证合字B2-20070004号
  • Manage cookies
  • Recevoir des actualités et des conseils par e-mail S’abonner
  • English
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Polski
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어