0

创建活动时如何在andorid maps api v2中获取地图右上角的经度和经度值。我写了代码,但有些如何得到零。

public class MainActivity extends android.support.v4.app.FragmentActivity
        implements OnClickListener {

  private GoogleMap mapView;

  @Override 
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mapView = ((SupportMapFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.map)).getMap();

    mapView.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(34.59,
                -113.236), 7));

    //** getting null values on the following line **
    LatLng values = mapView.getProjection().getVisibleRegion();
4

0 回答 0