Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android animateCamera GoogleMap.CancelableCallback Usage

I'm totally stumped on how to use the callback feature of "animateCamera" in android SDK.

I want to use the onFinish feature, thankyou.

public final void animateCamera (CameraUpdate update, GoogleMap.CancelableCallback callback)

http://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.html#animateCamera%28com.google.android.gms.maps.CameraUpdate,%20com.google.android.gms.maps.GoogleMap.CancelableCallback%29

http://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.CancelableCallback.html

like image 646
Hayden Thring Avatar asked Dec 31 '12 03:12

Hayden Thring


People also ask

What is Google map activity in Android?

Google map displays your current location, navigate location direction, search location etc. We can also customize Google map according to our requirement.

How do I ensure Google Maps Android API v2 is enabled?

Click on the “APIs & auth” menu on the left, and from the submenu select APIs. From the list of APIs that appear, scroll down and ensure that Google Maps Android API v2 is set to “On”.


1 Answers

No worries, i cant believe the moment i post this after looking for ages i find an example in the google play maps api samples that shows it....:

sdk\extras\google\google_play_services\samples\maps\src\com\example\mapdemo\CameraDemoActivity.java

changeCamera(CameraUpdateFactory.newCameraPosition(SYDNEY), 
        new CancelableCallback() {
    @Override
    public void onFinish() {
        Toast.makeText(getBaseContext(), "Animation to Sydney complete", 
            Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onCancel() {
        Toast.makeText(getBaseContext(), "Animation to Sydney canceled", 
            Toast.LENGTH_SHORT).show();
    }
});
like image 192
Hayden Thring Avatar answered Sep 20 '22 08:09

Hayden Thring