GoogleMap.OnMyLocationButton')}>
Antarmuka callback saat tombol Lokasiku diklik.
Metode Publik
Dipanggil saat tombol lokasi saya diklik.
Fungsi ini dipanggil di UI thread Android.
Gunakan com.google.android.gms.location.FusedLocationProviderApi jika Anda perlu mendapatkan lokasi pengguna saat ini.
Hasil
true
jika pemroses telah menggunakan peristiwa (yaitu, perilaku default
tidak akan terjadi); false
jika tidak (yaitu, perilaku default akan terjadi). Perilaku
default-nya adalah kamera bergerak sedemikian rupa sehingga berpusat pada lokasi pengguna.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-13 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-13 UTC."],[[["`GoogleMap.OnMyLocationButtonClickListener` is an interface used to handle clicks on the \"My Location\" button within a Google Map."],["The primary method, `onMyLocationButtonClick()`, is called when the button is clicked and allows custom actions to be performed before or instead of the default camera movement."],["Returning `true` from `onMyLocationButtonClick()` prevents the default behavior (centering the camera on the user's location), while returning `false` allows it."]]],["The `GoogleMap.OnMyLocationButtonClickListener` interface triggers the `onMyLocationButtonClick()` method when the \"My Location\" button is pressed. This method, executed on the UI thread, allows developers to handle the event. Returning `true` prevents the default camera movement to the user's location, while `false` allows it. For retrieving the user's location, the `FusedLocationProviderApi` is recommended.\n"]]