Der Quellanhang enthält nicht die Quelle für die Datei Layoutinflater.class

Ich versuche, eine Android-Anwendung zu schreiben, die Google Maps API Version 2 verwendet.
In Debug stürzt die Anwendung ab, wenn sie die Anweisung ausführt:

        setContentView(R.layout.activity_poi_map);

Das ist der Fehler:

Der Quellanhang enthält nicht die Quelle für die Datei Layoutinflater.class

Ich verstehe den Grund nicht. In den Headern habe ich die ganze Klasse importiert

android.view.*

Vielen Dank im Voraus für jede Antwort.

Dies ist der Code:

public class PoiMap extends FragmentActivity {

    private GoogleMap pMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent callerIntent = getIntent();
        final LatLng userCoord = callerIntent.getParcelableExtra("userCoord");
        final Poi poi = (Poi) callerIntent.getSerializableExtra("poi");

        setContentView(R.layout.activity_poi_map);
        setUpMapIfNeeded(userCoord);

        // Sets a callback that's invoked when the camera changes.
        pMap.setOnCameraChangeListener(new OnCameraChangeListener() {

            @Override
            /* Only use the simpler method newLatLngBounds(boundary, padding) to generate 
             * a CameraUpdate if it is going to be used to move the camera *after* the map 
             * has undergone layout. During layout, the API calculates the display boundaries 
             * of the map which are needed to correctly project the bounding box. 
             * In comparison, you can use the CameraUpdate returned by the more complex method 
             * newLatLngBounds(boundary, width, height, padding) at any time, even before the 
             * map has undergone layout, because the API calculates the display boundaries 
             * from the arguments that you pass. 
             * @see com.google.android.gms.maps.GoogleMap.OnCameraChangeListener#onCameraChange(com.google.android.gms.maps.model.CameraPosition)
             */
            public void onCameraChange(CameraPosition arg0) {
                // Move camera.
                if (poi != null){
                    LatLng poiCoord = poi.getLatLng();
                    pMap.addMarker(new MarkerOptions()
                    .position(poiCoord)
                    .title(poi.getName())
                    .snippet(poi.getCategory())
                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_star)));

                    Log.d("userCoord", userCoord.toString());
                    Log.d("poiCoord", poiCoord.toString());

                    double minY = Math.min(userCoord.latitude, poiCoord.latitude);
                    double minX = Math.min(userCoord.longitude, poiCoord.longitude);
                    double maxY = Math.max(userCoord.latitude, poiCoord.latitude);
                    double maxX = Math.max(userCoord.longitude, poiCoord.longitude);

                    Log.d("minY", " " + minY);
                    Log.d("minX", " " + minX);
                    Log.d("maxY", " " + maxY);
                    Log.d("maxX", " " + maxX);

                    LatLng northEast = new LatLng(maxY, maxX);
                    LatLng southWest = new LatLng(minY, minX);
                    LatLngBounds bounds = new LatLngBounds(southWest, northEast);

                    // move camera
                    pMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 40));

                    // Remove listener to prevent position reset on camera move.
                    pMap.setOnCameraChangeListener(null);
                }
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_poi_map, menu);
        return true;
    }

    @Override
    protected void onResume() {
        super.onResume();
        setUpMapIfNeeded(new LatLng(0.0, 0.0));
    }

    private void setUpMapIfNeeded(LatLng coord) {
        // Do a null check to confirm that we have not already instantiated the map.
        if (pMap == null) {
            // Try to obtain the map from the SupportMapFragment.
            pMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();
            // Check if we were successful in obtaining the map.
            if (pMap != null) {
                setUpMap(coord);
            }
        }
    }

    private void setUpMap(LatLng userCoord) {
        pMap.addMarker(new MarkerOptions()
                            .position(userCoord)
                            .title("Your location")
                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_user)));
        pMap.animateCamera(CameraUpdateFactory.newLatLng(userCoord));

        /* public static CameraUpdate newLatLngZoom (LatLng latLng, float zoom) 
         * Returns a CameraUpdate that moves the center of the screen to a latitude 
         * and longitude specified by a LatLng object, and moves to the given zoom 
         * level.
         * Parameters
         * latLng   a LatLng object containing the desired latitude and longitude.
         * zoom     the desired zoom level, in the range of 2.0 to 21.0. 
         * Values below this range are set to 2.0, and values above it are set to 21.0. 
         * Increase the value to zoom in. Not all areas have tiles at the largest zoom levels.
         * Returns
         * a CameraUpdate containing the transformation. 
*/
        pMap.animateCamera(CameraUpdateFactory.newLatLngZoom(userCoord, 15));

    }

}

Antworten auf die Frage(2)

Ihre Antwort auf die Frage