「MAIN CANNOT RESOLOVED OR NOT IN A FIELD」 setcontentview の mainactivity でエラーが発生します 「main を解決できないか、フィールドにありません。
これは私のコードです。解決方法を見つけるのに疲れたので、plz を助けてください。このエラーを削除してください」私の主な活動」
package com.exampl.goglemaps;
import android.os.Bundle;
import com.exampl.goglemaps.R;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
public class MainActivity extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//fetch the map view from the layout
MapView mapView = (MapView) findViewById(R.id.mapview);
//make available zoom controls
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
私のマニフェストファイル
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exampl.goglemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
それが私のxmlです
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="Your Google Maps API key"
android:clickable="true" />
</LinearLayout>
これは setContentView(R.layout.main) の mainactivity でエラーを呼び出します。「メインを解決できないか、フィールドではない」と言って、ほとんどすべてのフォーラムを検索しましたが、これを通過できませんでした。このエラーを解決するために私を助けてください。
見出し
前もって感謝します