I have two activities with same name on two different packages. One is just a subclass of another. I do this to use two different themes, depending on devices. (We use Theme.Dialog for larger screen device, and regular for others.) The inherited class only overrides onCreate to call its super method and set some window flags.
This works very well on all my devices, but I get very weird crash reports a few time.
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)
I did not create onCreateRegister so I assume it’s an internal name, but I am not sure. I use ProGuard but the line numbers should be showing if the recursive calls are by my code.
I can’t replicate it in any of my devices, and I get this report even from the same model I already test on, so it’s probably not a device-specific problem.
Does anybody have any idea why this is happening, or have a better way to handle this?
I renamed my classes so the parent and child classes don’t the same name any more, and it seemed to have solved the problem.