Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Peluncur
menampilkan label dan ikon untuk semua yang baru saja dilanjutkan
tugas. Jika paket aplikasi Anda
memiliki beberapa aplikasi sebagai aktivitas peluncur terpisah, peluncur tidak akan mengetahui
label dan ikon mana yang akan ditampilkan untuk aktivitas non-peluncur, seperti
aktivitas yang diluncurkan dari kartu atau notifikasi. Hal ini mungkin
menyebabkan aplikasi Anda tidak muncul di daftar Terbaru di peluncur atau ditampilkan
besar dengan tidak benar.
Memberi label semua aktivitas
Pastikan aktivitas Anda, termasuk aktivitas non-peluncur, diberi label
dengan benar dalam file manifes, seperti yang ditunjukkan dalam langkah berikut.
Gambar 1. Contoh aktivitas yang diberi label dengan benar.
Untuk setiap aktivitas dalam file AndroidManifest.xml, tentukan aktivitas peluncur
terkait.
Salin ikon, ikon bulat, dan label dari aktivitas peluncur
induk ke setiap aktivitas non-peluncur terkait.
Untuk aktivitas yang dibagikan di antara beberapa aktivitas peluncur, tentukan
ikon dan label yang akan ditampilkan untuk mewakili semuanya.
Menetapkan RecentTasks
Agar dapat menggunakan RecentTasks untuk bagian Terbaru dalam peluncur, pastikan elemen taskAffinity Anda ditentukan dengan benar di file AndroidManifest.xml dan Anda mengelola tugas dan data sebelumnya secara konsisten.
Ingatlah selalu hal-hal berikut saat Anda menetapkan tugas:
Pilih nama taskAffinity
yang unik untuk setiap tugas di aplikasi Anda. Anda dapat menganggap setiap aktivitas peluncur
dan turunannya sebagai satu tugas. Tetapkan taskAffinity tersebut ke setiap aktivitas
terkait dalam file manifes Anda.
Hindari membuat aktivitas trampolin, yaitu aktivitas yang hanya
meluncurkan aktivitas lainnya. Buat layar pembuka menggunakan
SplashScreen API.
Gunakan tanda android:excludeFromRecents="true" dan android:noHistory="true"
saat Anda tidak ingin aktivitas Anda muncul di bagian Terbaru.
Tentukan mode peluncuran
yang terbaik untuk aktivitas Anda, dan kembangkan dengan mempertimbangkan hal tersebut.
Tips proses debug
Perhatikan hal-hal berikut saat proses debug:
Jika ada entri ganda di bagian Terbaru untuk satu aplikasi,
periksa apakah Anda menggunakan tanda NEW_TASK dengan tidak benar.
Jika ikon atau label yang ditampilkan salah, pastikan setiap aktivitas
non-peluncur terkait memiliki ikon, ikon bulat, dan label yang sama dengan aktivitas
induknya.
Jika sistem tidak meluncurkan apa pun setelah mengetuk entri di
peluncur, periksa Logcat (yang difilter untuk "peluncur") untuk menemukan error, karena masalah ini dapat
disebabkan oleh aktivitas trampolin.
Direkomendasikan untuk Anda
Catatan: teks link ditampilkan saat JavaScript nonaktif
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-27 UTC."],[],[],null,["# Appear in recents and app resume\n\nThe [launcher](/training/wearables/user-interfaces#app_launcher_entries)\ndisplays a label and icon for any recently resumed\n[tasks](/guide/components/activities/tasks-and-back-stack). If your app package\nhas multiple apps as separate launcher activities, the launcher doesn't know\nwhich label and icon to show for non-launcher activities, such as\nactivities launched from a tile or a notification. This might\ncause your app to not show up in the **Recents** list in the launcher or to show\nup incorrectly.\n\nLabel all activities\n--------------------\n\nEnsure that your activities, including non-launcher activities, are properly\nlabelled in your manifest file, as shown in the following steps.\n\n\n**Figure 1.** Examples of properly labeled activities.\n\n1. For every activity in your `AndroidManifest.xml` file, determine which launcher activity it belongs to.\n2. Copy the icon, round icon, and label from the parent launcher activity into each associated non-launcher activity.\n3. For activities that are shared among multiple launcher activities, decide\n which icon and label to display that represents all of them.\n\n | **Note:** If the launcher is unable to determine the correct icon and label, it defaults to the icon and label of your application tag.\n\nAssign RecentTasks\n------------------\n\nTo use `RecentTasks` for the **Recents** section in the launcher, ensure that your\n`taskAffinity` elements are correctly defined in your `AndroidManifest.xml` file and\nthat you manage your tasks and back stack consistently.\n\nKeep the following considerations in mind as you assign tasks:\n\n- Choose a unique [`taskAffinity`](/guide/topics/manifest/activity-element#aff) name for each task in your app. You can consider each launcher activity and its children as one task. Assign that `taskAffinity` to every related activity in your manifest file.\n- Avoid calling `startActivity()` with [`FLAG_ACTIVITY_NEW_TASK`](/reference/android/content/Intent#FLAG_ACTIVITY_NEW_TASK) or [`FLAG_ACTIVITY_CLEAR_TOP`](/reference/android/content/Intent#FLAG_ACTIVITY_CLEAR_TOP).\n- Avoid creating *trampoline activities* , which are activities that only launch other activities. Create splash screens using the [SplashScreen API](/reference/android/R.attr#windowSplashscreenContent).\n- Use `android:excludeFromRecents=\"true\"` and `android:noHistory=\"true\"` flags when you don't want your activity to show up in the **Recents** section.\n- Determine the best [launch mode](/guide/components/activities/tasks-and-back-stack#TaskLaunchModes) for your activities and develop with that in mind.\n\nDebugging tips\n--------------\n\nLook out for the following things when debugging:\n\n- If there are double entries in the **Recents** section for a single app, check whether you are using the `NEW_TASK` flag inappropriately.\n- If the wrong icon or label displays, ensure that each associated non-launcher activity has the same icon, round icon, and label as its parent activity.\n- If the system doesn't launch anything after tapping the entry in the launcher, check Logcat (filtered on \"launcher\") for errors, as this issue can be caused by a trampoline activity.\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Tasks and the back stack](/guide/components/activities/tasks-and-back-stack)\n- [Create custom Quick Settings tiles for your app](/develop/ui/views/quicksettings-tiles)\n- [Learn Jetpack Navigation](/codelabs/android-navigation)"]]