无法实施Google Map V2

时间:2013-11-08 04:09:34

标签: android google-maps

我正在尝试实施Google地图。但我得到了充气错误。任何人都可以提供一个示例代码来实现谷歌地图。

谢谢

这是我的代码

public class GMap extends FragmentActivity implements LocationListener{

    public static GoogleMap mMap;
    LocationManager locationManager;
    Criteria criteria;
    String provider;
    Location location;



      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_gmap);
          setUpMapIfNeeded();
      }
      @Override
      protected void onResume() {
          super.onResume();
          setUpMapIfNeeded();
      }
 private void setUpMapIfNeeded() {
  // Do a null check to confirm that we have not already instantiated the map.
        if (mMap == null) {
            // Try to obtain the map from the SupportMapFragment.
            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
              .getMap();
            // Check if we were successful in obtaining the map.
        if (mMap != null) {
                setUpMapIfNeeded();
      }
  }
}

1 个答案:

答案 0 :(得分:0)

以下是我认为使用谷歌地图v2的最佳示例。您必须观看此link