Oluştur'da durum
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Compose tabanlı uygulamanızda durumu nasıl oluşturacağınızı ve yöneteceğinizi, kullanıcı arayüzünü durumdaki değişikliklere tepki verecek şekilde nasıl yapılandıracağınızı öğrenin. Gözlemlenebilir durumları nasıl oluşturacağınızı, yeniden derlemeler veya yapılandırma değişiklikleri sırasında durumu nasıl koruyacağınızı ve en uygun veri akışı için bileşenlerinizi nasıl yapılandıracağınızı öğrenin.
Önemli noktalar
- Uygulamanızın durumu bir bileşen içindeyse durumu yeniden derleme boyunca korumak için
remember
kullanın.
- Durumu yapılandırma değişikliklerinde korumak için
rememberSaveable
kullanın.
- Durum kaldırma, durumu bir bileşenin arayanına taşıdığınız bir programlama kalıbıdır. Mümkünse bileşeni daha yeniden kullanılabilir ve test edilebilir hale getirmek için durum kaldırma özelliğini kullanın.
ViewModel
sınıfını kullanarak, gözlemlenebilir bir durum tutucuda açık bir durumu tutun. Böylece durumu daha iyi kapsülleyebilir ve kullanıcı arayüzü için tek bir doğruluk kaynağı oluşturabilirsiniz.
Kaynaklar
Bu kılavuzu içeren koleksiyonlar
Bu kılavuz, daha geniş Android geliştirme hedeflerini kapsayan, özel olarak seçilmiş Hızlı Kılavuz koleksiyonlarından biridir:
Oluşturmayla ilgili temel bilgiler (video koleksiyonu)
Bu video serisinde, çeşitli Compose API'leri tanıtılır ve mevcut API'ler ile bunların nasıl kullanılacağı hızlıca gösterilir.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# State in Compose\n\n\u003cbr /\u003e\n\nLearn how to establish and manage state in your Compose-based app and how\nto configure the UI to react to changes in state. See how to create observable\nstates, how to retain state across recompositions or configuration changes, and\nhow to structure your composables for optimal data flow. \n\nKey points\n----------\n\n- If your app's state is internal to a composable, use [`remember`](/reference/kotlin/androidx/compose/runtime/package-summary#remember(kotlin.Function0)) to persist the state across re-composition.\n- Use [`rememberSaveable`](/reference/kotlin/androidx/compose/runtime/saveable/package-summary#rememberSaveable(kotlin.Array,androidx.compose.runtime.saveable.Saver,kotlin.String,kotlin.Function0)) to persist the state across configuration changes.\n- *State hoisting* is a programming pattern where you move the state to the caller of a composable. Where possible, use state hoisting to make the composable more reusable and testable.\n- Use the [`ViewModel`](/reference/androidx/lifecycle/ViewModel) class to hold an exposed state in an observable state holder, better encapsulating the state and creating a single source of truth for the UI.\n\nResources\n---------\n\n- [Codelab: State in Jetpack Compose](/codelabs/jetpack-compose-state#0)\n\nCollections that contain this guide\n-----------------------------------\n\nThis guide is part of these curated Quick Guide collections that cover\nbroader Android development goals: \n\n### Compose basics (video collection)\n\nThis series of videos introduces various Compose APIs, quickly showing you what's available and how to use them. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/compose-basics) \n\nHave questions or feedback\n--------------------------\n\nGo to our frequently asked questions page and learn about quick guides or reach out and let us know your thoughts. \n[Go to FAQ](/quick-guides/faq) [Leave feedback](https://issuetracker.google.com/issues/new?component=1573691&template=1993320)"]]