Hallo, ich bin neu in Android-Programmierung und arbeitet an Eclipse. Ich habe ein Fehler „Layout nicht aufgelöst werden kann oder kein Feld“ in dem folgenden Programm:Java. Layout kann nicht gelöst werden oder ist kein Feld
package com.esri.android.sample;
import android.app.Activity;
import android.os.Bundle;
import com.esri.android.map.MapView;
import com.esri.android.map.ags.ArcGISDynamicMapServiceLayer;
import com.esri.android.R;
public class HelloWorldMapActivity extends Activity {
MapView map = null;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Retrieve the map and initial extent from XML layout
map = (MapView)findViewById(R.id.map);
// Add dynamic layer to MapView
map.addLayer(new ArcGISDynamicMapServiceLayer("" +
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
//Retrieve the non-configuration instance data that was previously returned.
Object init = getLastNonConfigurationInstance();
if (init != null) {
map.restoreState((String) init);
}
}
protected void onPause() {
super.onPause();
map.pause();
}
protected void onResume() {
super.onResume();
map.unpause();
}
}
Diese Fehler werden auf die Aussagen gezeigt setContentView(R.layout.main);
und map = (MapView)findViewById(R.id.map);
Ich weiß nicht, warum es zeigt diese Fehler. Irgendeine Idee, was ist das Problem in diesem Programm?
Können wir Ihre XML-Layoutdatei sehen? – Katana24