,即時通訊得到的錯誤: - 編碼部分的AndroidRuntime(528):了java.lang.RuntimeException:無法實例活動
04-08 00:37:48.540: E/AndroidRuntime(528): java.lang.RuntimeException:
Unable to instantiate activity ComponentInfo{com.android.collision/
com.android.collision.GameViewActivity}: java.lang.InstantiationException:
can't instantiate class com.android.collision.GameViewActivity; no empty constructor
其他deatils和我有通過SurfaceView
致以主要活動類我的清單XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.collision"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".GameViewActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
我的郵件活動是: -
public class GameViewActivity extends SurfaceView {
/** Called when the activity is first created. */
public GameViewActivity(Context context) {
super(context);
}
我需要通過SurfaceView – user2255336 2013-04-07 20:11:14
如果你需要使用SurfaceView致以活動類,你需要將它添加到您的活動的佈局,沒有繼承它。 – dongshengcn 2013-04-07 20:14:07
感謝您的關注我的問題,但我不知道如何將其添加到我的活動類 – user2255336 2013-04-07 20:17:27