Đây là code của mình , mình chỉ muốn chương trình chạy bình thường , ko hiện gì cũng được nhưng nó ko báo lỗi stopped nữa.
Theo code mình xem trên mạng thì nó có @Override ở mỗi method, nhưng mình pải remove nó đi vì nó báo lỗi , help me
Mã:
public class TestActivity extends BaseGameActivity { //declaring the height and width of the camera(same on every device) private static final int CAMERA_WIDTH = 720; private static final int CAMERA_HEIGHT = 480; //setting up a camera private Camera mCamera; public Engine onLoadEngine() { //setting up the camera in a certain position with the height and width stated before this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT); //returning an engine with the camera and all of the other stuff, you can try to change some stuff around return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera)); } public void onLoadResources() { //this is where you set up all of the sprites and atlases } public Scene onLoadScene() { this.mEngine.registerUpdateHandler(new FPSLogger()); final Scene scene = new Scene(); //you don't have to set the background color but it is just so you would see that it is working scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f)); //you have to return a scene so the game will actually run... return scene; } public void onLoadComplete() { // nothing to do here.. }}
Logcat
Mã:
04-05 00:30:20.523: W/dalvikvm(674): Unable to resolve superclass of Lat/exam/TestActivity; (31)04-05 00:30:20.593: W/dalvikvm(674): Link of class 'Lat/exam/TestActivity;' failed04-05 00:30:20.593: D/AndroidRuntime(674): Shutting down VM04-05 00:30:20.613: W/dalvikvm(674): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)04-05 00:30:20.683: E/AndroidRuntime(674): FATAL EXCEPTION: main04-05 00:30:20.683: E/AndroidRuntime(674): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{at.exam/at.exam.TestActivity}: java.lang.ClassNotFoundException: at.exam.TestActivity04-05 00:30:20.683: E/AndroidRuntime(674): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)04-05 00:30:20.683: E/AndroidRuntime(674): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)04-05 00:30:20.683: E/AndroidRuntime(674): at android.app.ActivityThread.access$600(ActivityThread.java:123)04-05 00:30:20.683: E/AndroidRuntime(674): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)04-05 00:30:20.683: E/AndroidRuntime(674): at android.os.Handler.dispatchMessage(Handler.java:99)04-05 00:30:20.683: E/AndroidRuntime(674): at android.os.Looper.loop(Looper.java:137)04-05 00:30:20.683: E/AndroidRuntime(674): at android.app.ActivityThread.main(ActivityThread.java:4424)04-05 00:30:20.683: E/AndroidRuntime(674): at java.lang.reflect.Method.invokeNative(Native Method)04-05 00:30:20.683: E/AndroidRuntime(674): at java.lang.reflect.Method.invoke(Method.java:511)04-05 00:30:20.683: E/AndroidRuntime(674): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)04-05 00:30:20.683: E/AndroidRuntime(674): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)04-05 00:30:20.683: E/AndroidRuntime(674): at dalvik.system.NativeStart.main(Native Method)04-05 00:30:20.683: E/AndroidRuntime(674): Caused by: java.lang.ClassNotFoundException: at.exam.TestActivity04-05 00:30:20.683: E/AndroidRuntime(674): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)04-05 00:30:20.683: E/AndroidRuntime(674): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)04-05 00:30:20.683: E/AndroidRuntime(674): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)04-05 00:30:20.683: E/AndroidRuntime(674): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)04-05 00:30:20.683: E/AndroidRuntime(674): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)04-05 00:30:20.683: E/AndroidRuntime(674): ... 11 more04-05 00:30:23.933: I/Process(674): Sending signal. PID: 674 SIG: 9
Manifest
Mã:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="at.exam" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="15" /> <uses-permission android:name="android.permission.WAKE_LOCK"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".TestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
Nếu ko giúp đc thì bạn nào có code nào đơn giản share cho mình ( ko cần hoạt động gì nhiều chỉ cần 1 class kế thừa basegameactivity mà nó ko throw ra 1 cái exception nào là đc , chương trình đen thui cũng ok (mình ko thể sử dụng @Override được với các method
Mã:
public Engine onLoadEngine()
Mã:
public void onLoadResources()
Mã:
public Scene onLoadScene()
Mã:
public void onLoadComplete()
Nếu sử dụng là nó báo
Mã:
The method onLoadEngine() of type TestActivity must override a superclass method
phải remove @Override đi thì mới chạy đc android
View more random threads:
Vòng tay phong thủy là một vật phẩm mang lại sự may mắn trong tài lộc, tình duyên, sự nghiệp,.. Là một vật phẩm không xa lạ gì với chúng ta, vòng tay phong thủy có nhiều màu, đa dạng và mỗi màu sắc...
Ý nghĩa và cách phân loại vòng tay...