1
爲了便於使用,我想用某個類擴展一個Android活動,以賦予它額外的功能,然後使用該類的主要活動間接擴展活動
class SuperActivity extends Activity {
//Very nice extra functions
}
//Class defined in the manifest.xml
class ApplicationActivity extends SuperActivity {
//Start the application
}
有沒有辦法做到這一點?目前在上述形式的給我一個類未發現異常..
的logcat:
10-08 12:23:28.316: ERROR/AndroidRuntime(678): Uncaught handler: thread main exiting due to uncaught exception
10-08 12:23:28.336: ERROR/AndroidRuntime(678): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{ntx.app/ntx.app.AppActivity}: java.lang.ClassNotFoundException: ntx.app.AppActivity in loader [email protected]
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2324)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.os.Handler.dispatchMessage(Handler.java:99)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.os.Looper.loop(Looper.java:123)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.app.ActivityThread.main(ActivityThread.java:4203)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:521)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at dalvik.system.NativeStart.main(Native Method)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): Caused by: java.lang.ClassNotFoundException: ntx.app.AppActivity in loader [email protected]
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
10-08 12:23:28.336: ERROR/AndroidRuntime(678): ... 11 more
當我讓AppActivity延長android.app.Activity
你能從logcat發佈更多的錯誤嗎? – Intrications 2009-10-08 10:05:10