문제

I want to use a custom button to change camera focus to my current location. I am using ImageButton and trying to add it to setOnMyLocationButtonClickListener(this) but i can't. What should i do to use method of OnMyLocationButtonClickListener interface.

Here's the code:

    public class MainActivity extends Activity implements OnMyLocationButtonClickListener {
    ...
    getMyLocation = (ImageButton) findViewById(R.id.getMyLocation_button);

    getMyLocation.setOnMyLocationButtonClickListener(this); 
//gives error: setOnMyLocationButtonClickListener() is undefined

Please help, thanks!

도움이 되었습니까?

해결책

Instead you can add the following code to your ImageButton listener.

LatLong coordinates = new LatLng(yourLatitude,yourLongitude);
yourMap.animateCamera(CameraUpdateFactory.newLatLngZoom(coordinates,zoomLevel));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top