קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הודעה קופצת מספקת משוב פשוט על פעולה בחלון קופץ קטן. זה בלבד
ממלא את השטח הנדרש להודעה ואת הפעילות הנוכחית
נשארים גלויים ואינטראקטיביים. ההודעות הקוליות נעלמות באופן אוטומטי אחרי הזמן הקצוב לתפוגה.
לדוגמה, לחיצה על שליחה באימייל מפעילה את ההודעה 'שליחת ההודעה...'
הודעה קופצת, כמו בצילום המסך הבא:
אם האפליקציה שלך מטרגטת את Android 12 (רמת API 31) ואילך, ההודעה הקולית מוגבלת ל-Android 12 (רמת API 31) ואילך
שתי שורות טקסט, וסמל האפליקציה מופיע ליד הטקסט. שימו לב
אורך השורה של טקסט זה משתנה בהתאם לגודל המסך, לכן כדאי לוודא
טקסט קצר ככל האפשר.
חלופות לשימוש בסיטונות
אם האפליקציה פועלת בחזית, כדאי להשתמש
סרגל חטיפים במקום להשתמש בכרטיס טוסט.
סרגלים אינטראקטיביים כוללים אפשרויות שניתנות לפעולה כדי לשפר את האפליקציה
חוויה אישית.
אם האפליקציה פועלת ברקע וברצונך שהמשתמשים יבצעו פעולה מסוימת, אפשר להשתמש
התראה
במקום זאת.
אפשר לשרשר את השיטות כדי להימנע משמירת האובייקט Toast, כמו שמוצג
בקטע הקוד הבא:
Kotlin
Toast.makeText(context,text,duration).show()
Java
Toast.makeText(context,text,duration).show();
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Toasts overview\n\nA toast provides simple feedback about an operation in a small popup. It only\nfills the amount of space required for the message and the current activity\nremains visible and interactive. Toasts automatically disappear after a timeout.\n\nFor example, clicking **Send** on an email triggers a \"Sending message...\"\ntoast, as shown in the following screen capture:\n\nIf your app targets Android 12 (API level 31) or higher, its toast is limited to\ntwo lines of text and shows the application icon next to the text. Be aware that\nthe line length of this text varies by screen size, so it's good to make the\ntext as short as possible.\n\nAlternatives to using toasts\n----------------------------\n\nIf your app is in the foreground, consider using a\n[snackbar](https://material.io/components/snackbars) instead of using a toast.\nSnackbars include user-actionable options, which can provide a better app\nexperience.\n\nIf your app is in the background, and you want users to take some action, use\na [notification](/develop/ui/views/notifications)\ninstead.\n\nInstantiate a Toast object\n--------------------------\n\nUse the\n[`makeText()`](/reference/android/widget/Toast#makeText(android.content.Context,%20int,%20int))\nmethod, which takes the following parameters:\n\n1. The activity [`Context`](/reference/android/content/Context).\n2. The text that should appear to the user.\n3. The duration that the toast should remain on the screen.\n\nThe `makeText()` method returns a properly initialized `Toast` object.\n\nShow the toast\n--------------\n\nTo display the toast, call the\n[`show()`](/reference/android/widget/Toast#show()) method, as demonstrated in\nthe following example: \n\n### Kotlin\n\n```kotlin\nval text = \"Hello toast!\"\nval duration = Toast.LENGTH_SHORT\n\nval toast = Toast.makeText(this, text, duration) // in Activity\ntoast.show()\n```\n\n### Java\n\n```java\nCharSequence text = \"Hello toast!\";\nint duration = Toast.LENGTH_SHORT;\n\nToast toast = Toast.makeText(this /* MyActivity */, text, duration);\ntoast.show();\n```\n\nChain your toast method calls\n-----------------------------\n\nYou can chain your methods to avoid holding on to the `Toast` object, as shown\nin the following code snippet: \n\n### Kotlin\n\n```kotlin\nToast.makeText(context, text, duration).show()\n```\n\n### Java\n\n```java\nToast.makeText(context, text, duration).show();\n```"]]