我在两个不同的包上有两个具有相同名称的活动。一个只是另一个的子类。我这样做是根据设备使用两个不同的主题。 (我们将Theme.Dialog用于较大的屏幕设备,对其他设备使用Theme.Dialog。)继承类仅覆盖onCreate
以调用其超级方法并设置一些窗口标志。Activity.onCreate上的StackOverflowError
这在我的所有设备上都能很好地工作,但是我几次得到非常奇怪的故障报告。
java.lang.StackOverflowError
at *****.activities.Register.onCreate(SourceFile)
at *****.tablet.Register.onCreateRegister(SourceFile)
(a lot of repeats)
at *****.activities.Register.onCreate(SourceFile)
at *****.tablet.Register.onCreateRegister(SourceFile)
at *****.activities.Register.onCreate(SourceFile)
at *****.tablet.Register.onCreateRegister(SourceFile)
at *****.tablet.Register.onCreate(SourceFile)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:850)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
我没有创建onCreateRegister
,所以我认为它是一个内部的名字,但我不知道。我使用ProGuard,但是如果递归调用是由我的代码显示的,行号应该显示。
我无法在任何设备上复制它,甚至可以从我已经测试过的同一型号中获得此报告,因此它可能不是设备特定的问题。
有没有人知道为什么会发生这种情况,或者有更好的方法来处理这个问题?