-1

以下代码在run()_ _ 有人帮助完成基本步骤。这是代码:@overriderun()draw()

    private class MyWallpaperEngine extends Engine {
            private final Handler handler = new Handler();
            private final Runnable drawRunner = new Runnable() {
                public void run() {
                    draw();
                }
            };
    }

12-14 00:55:24.111: W/dalvikvm(7141): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
12-14 00:55:24.181: E/AndroidRuntime(7141): FATAL EXCEPTION: main
12-14 00:55:24.181: E/AndroidRuntime(7141): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.sri.alinwallpaper/com.sri.alinwallpaper.MyPoint}: java.lang.InstantiationException: can't instantiate class com.sri.alinwallpaper.MyPoint; no empty constructor
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.app.ActivityThread.access$600(ActivityThread.java:122)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.os.Looper.loop(Looper.java:137)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.app.ActivityThread.main(ActivityThread.java:4340)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at java.lang.reflect.Method.invokeNative(Native Method)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at java.lang.reflect.Method.invoke(Method.java:511)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at dalvik.system.NativeStart.main(Native Method)
12-14 00:55:24.181: E/AndroidRuntime(7141): Caused by: java.lang.InstantiationException: can't instantiate class com.sri.alinwallpaper.MyPoint; no empty constructor
12-14 00:55:24.181: E/AndroidRuntime(7141):     at java.lang.Class.newInstanceImpl(Native Method)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at java.lang.Class.newInstance(Class.java:1319)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
12-14 00:55:24.181: E/AndroidRuntime(7141):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
12-14 00:55:24.181: E/AndroidRuntime(7141):     ... 11 more
12-14 00:55:37.751: I/Process(7141): Sending signal. PID: 7141 SIG: 9
4

1 回答 1

1

删除@Override注释。没有它应该可以正常工作。

根据这个问题的答案,这是因为在 Java 5 中,您不能将 @Override 注释与实现接口的方法一起使用,只能使用超类中方法的实际覆盖。

于 2012-12-13T19:13:29.873 回答