So my app has been immediately giving an ANR when one of my classes is run. Ive been looking through the debugger and trying to understand what is go开发者_如何学Cing on. I'm new to android, and have zero experienced debugging. So if anyone could help me make sense of what is going on that would be great.
My onCreate(): http://pastebin.com/QzT5KA0L
My GuiThreader(used in onCreate): http://pastebin.com/VCp7KegY
Here is what shows up on my Debug tab when the app fails:
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord) line: 2268
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord) line: 2284
ActivityThread.access$1800(ActivityThread, ActivityThread$ActivityRecord) line: 112
ActivityThread$H.handleMessage(Message) line: 1692
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 3948
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 782
ZygoteInit.main(String[]) line: 540
NativeStart.main(String[]) line: not available [native method]
The game loop should be in a thread of his own. I have no experience about this kind of things, but Android expects the onCreate()
method to end in short time, because that runs on the main/UI thread, which should remain free to manage the application lifecycle.
精彩评论