1

Googleマップを実装しようとしています。しかし、インフレエラーが発生しています。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();
      }
  }
}
4

0 に答える 0