相关疑难解决方法(0)

Android Google服务广告选择器setLatLngBounds()无效

我在我的应用程序中使用PlacePicker.突然间,它表现得很糟糕.当它发射时指向(0.0,0.0)lat lng.我不确定Google服务是否有所改变.早些时候它工作得很好,因为从3天开始它不起作用.

我在这做错了吗?

这是我如何启动活动.

private void launchPlacePicker(double latitude, double longitude) {
    try {
        showProgress(true);
        PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();

        Log.d(TAG, " launchPlacePicker " + latitude + " " + longitude);

        builder.setLatLngBounds(MapUtils.getLatLngBounds(new LatLng((double) latitude, (double) longitude)));

        startActivityForResult(builder.build(this), PLACE_PICKER_REQUEST);
    } catch (GooglePlayServicesRepairableException e) {
        showProgress(false);
        Log.e(TAG, "GooglePlayServicesRepairableException", e);
    } catch (GooglePlayServicesNotAvailableException e) {
        showProgress(false);
        Log.e(TAG, "GooglePlayServicesNotAvailableException", e);
    }
}
Run Code Online (Sandbox Code Playgroud)

这就是我创建LatLngBounds的方法

public static LatLngBounds getLatLngBounds(LatLng center) {
    double radius = 100;
    LatLng southwest = SphericalUtil.computeOffset(center, radius * Math.sqrt(2.0), 225);
    LatLng northeast = SphericalUtil.computeOffset(center, …
Run Code Online (Sandbox Code Playgroud)

android google-maps android-studio

10
推荐指数
1
解决办法
2720
查看次数

标签 统计

android ×1

android-studio ×1

google-maps ×1