I'm using Huawei MapKit and I want to add my custom MyLocationButton but I don't want to use the location manager to get my location and move to it, I just want to huaweiMapMyLocationButton.performClick(), for example, with google maps I can do this
val locationButtonParent = view?.findViewById<View>(Integer.parseInt("1"))?.parent as? View?
val locationButton = locationButtonParent?.findViewById<View>(Integer.parseInt("2"))
locationButton.performClick()
I want something like this for huawei maps, I was able to go through the children of the map's view and I found the ui settings views ( Zoom, Compass, Location ) and following the location I was able to get this :
val mapFragment = childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment
val fragmentView = mapFragment.view
val myLocationButton =
((((fragmentView as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(1) as ViewGroup).getChildAt(
1
) as ViewGroup).getChildAt(0)
But this didn't work