我的主要游戏活动课程:
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class SFGame extends Activity{
SFGameView gameview;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
gameview= new SFGameView(this);
Log.d("ashwin", "wrong");
setContentView(gameview);
}
}
我的 SFGameView 类代码:
import android.content.Context;
import android.opengl.GLSurfaceView;
public class SFGameView extends GLSurfaceView{
public SFGameView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
}
setContentView(gameview)
当我尝试从类中调用时,我发现错误正在发生SFGameView
。
是否有必要class SFGameView extends GLSUrfaceView
在类似服务的清单中添加它?如果是,那怎么办?
清单
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.ku.starfighter.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>
<activity android:name="Sfmainmenu"
android:screenOrientation="portrait"></activity>
<activity android:name="SFGame"
android:screenOrientation="portrait"></activity>
<service android:name="SFMusic"></service>
</application>