קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בדף הזה מוסברות שיטות מומלצות לניקוי מופעים אחרי שהם כבר לא נחוצים.
שימוש ב-Navigator#clearDestinations וב-Navigator#cleanup כשסשנים של ניווט מסתיימים
כדי למנוע דליפות זיכרון ולהבטיח ניקוי תקין, משתמשים ב-Navigator#clearDestinations וב-Navigator#cleanup אחרי השלמת סשן הניווט, כשאין יותר צורך במופע Navigator. אפשר לעשות את זה כשהמשתמש עובר למקום אחר במפה וכשמפעילים את onDestroy() של הפעילות המשויכת.
ניקוי של רכיבי GoogleMap כשכבר לא צריך אותם
אם האפליקציה שלכם משתמשת במופע GoogleMap כדי להציג מפות שלא קשורות לניווט, הקפידו לנקות את המופע הזה כשכבר אין בו צורך. לדוגמה, כדי לנקות את הרכיבים Polygon, Polyline ו-Marker שמשויכים ל-GoogleMap, צריך לקרוא לשיטות Polygon#remove, Polyline#remove ו-Marker#remove, בהתאמה. לאחר מכן, כדי לפנות את המופע GoogleMap אחרי שהוא כבר לא נחוץ, קוראים ל-GoogleMap#clear ומקצים את המופע ל-null.
[[["התוכן קל להבנה","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-09-04 (שעון UTC)."],[[["\u003cp\u003eUse \u003ccode\u003eNavigator#clearDestinations\u003c/code\u003e and \u003ccode\u003eNavigator#cleanup\u003c/code\u003e when navigation sessions are completed to prevent memory leaks.\u003c/p\u003e\n"],["\u003cp\u003eClean up \u003ccode\u003eGoogleMap\u003c/code\u003e elements like Polygons, Polylines, and Markers by calling their respective \u003ccode\u003eremove\u003c/code\u003e methods when they are no longer needed.\u003c/p\u003e\n"],["\u003cp\u003eAfter a \u003ccode\u003eGoogleMap\u003c/code\u003e instance is no longer in use, call \u003ccode\u003eGoogleMap#clear\u003c/code\u003e and assign the instance to \u003ccode\u003enull\u003c/code\u003e to free up resources.\u003c/p\u003e\n"]]],[],null,[]]