Android animateCamera GoogleMap.CancelableCallback用法

时间:2012-12-31 03:37:09

标签: android google-maps

我完全不知道如何在android sdk中使用“animateCamera”的回调功能。

我想使用onFinish功能,谢谢你。

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

1 个答案:

答案 0 :(得分:11)

不用担心,我不敢相信我在寻找年龄后发布这个时刻的那一刻我在谷歌播放地图api样本中找到一个例子,显示它....:

SDK \额外\谷歌\ google_play_services \样品\地图\ SRC \ COM \示例\ 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();
    }
});