Reputation: 1
the error that i m getting :-
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
other deatils of the coding portion and i have to extend my main activity class by SurfaceView
my manifest 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>
And my mail activity is :-
public class GameViewActivity extends SurfaceView {
/** Called when the activity is first created. */
public GameViewActivity(Context context) {
super(context);
}
Upvotes: 0
Views: 537
Reputation: 2835
java.lang.RuntimeException: Unable to instantiate activity
so do it like this
public class GameViewActivity extends Activity
or you can extend any activity from your project eg.
public class GameViewActivity extends GameActivity
Upvotes: 0
Reputation: 6514
Your activity must extend an Activity class.
http://developer.android.com/reference/android/app/Activity.html
Upvotes: 3