MapsMapsizer
אפשר להשתמש במחלקה הזו כדי לאתחל את ה-SDK של מפות Google ל-Android, במקרים שבהם צריך להשתמש בתכונות לפני
קבלת המפה. צריך להפעיל אותה כי צריך לאתחל מחלקות מסוימות, כמו BitmapDescriptorFactory ו-cameraUpdateFactory.
אם נעשה שימוש ב-MapFragment
או ב-MapView
וכבר השגת GoogleMap
(לא null)
כשמתקשרים ל-getMapAsync()
באחת מהמחלקות האלה וממתינים
לשיחה החוזרת (callback) ב-onMapReady(GoogleMap map)
, אין צורך לדאוג לגבי המחלקה הזו. אפשר לראות
כמה דוגמאות באפליקציה לדוגמה.
סיכום אמצעי תשלום ציבורי
int
סטטי מסונכרן
|
initialize(הקשר לפי הקשר)
מפעיל את ה-SDK של מפות Google ל-Android כדי שהמחלקות שלו יהיו מוכנות לשימוש.
|
סיכום שיטות שעברו בירושה
מכיתה
java.lang.Object
boolean
|
equals(Object arg0)
|
סופי
כיתה<?>
|
getClass()
|
int
|
hashCode()
|
תוקף
סופי
|
notify()
|
תוקף
סופי
|
notifyAll()
|
מחרוזת
|
toString()
|
תוקף
סופי
|
wait(long arg0, int arg1)
|
תוקף
סופי
|
wait(long arg0)
|
תוקף
סופי
|
wait()
|
שיטות ציבוריות
Public
סטטי מסונכרן
int
initialize
(הקשר הקשר)
מפעיל את ה-SDK של מפות Google ל-Android כדי שהמחלקות שלו יהיו מוכנות לשימוש. אם נעשה שימוש ב-MapFragment
או ב-MapView
וכבר השגת GoogleMap
(שאינו null) על ידי התקשרות ל-getMapAsync()
באחת מהמחלקות האלה, אין צורך לבצע קריאה לפונקציה.
פרמטרים
context |
נדרש כדי לאחזר את הקוד והמשאבים הנחוצים של ה-SDK. לא יכול להיות null . |
החזרות
- קוד שגיאה של ConnectionResult.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-13 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-13 (שעון UTC)."],[[["The `MapsInitializer` class is used to initialize the Google Maps SDK for Android, particularly when features are needed before a map is obtained."],["It's crucial to call `MapsInitializer.initialize()` because classes like `BitmapDescriptorFactory` and `CameraUpdateFactory` require prior initialization."],["If you're using `MapFragment` or `MapView` and have a non-null `GoogleMap` instance through `getMapAsync()`, you don't need to explicitly call `MapsInitializer.initialize()`."],["The `initialize()` method takes a Context as a parameter and returns a `ConnectionResult` error code indicating the success of the initialization."]]],["The `MapsInitializer` class initializes the Google Maps SDK for Android, enabling the use of classes like `BitmapDescriptorFactory` and `CameraUpdateFactory`. It is necessary when map features are used before obtaining a map. Initialization is performed via the `initialize(Context context)` method, which requires a non-null context. This step is not required if a `GoogleMap` is already obtained via `getMapAsync()` on `MapFragment` or `MapView`. The method returns a `ConnectionResult` error code.\n"]]