views:

48

answers:

1

The application works fine in the emulator. This issue manifests on the Sprint HTC Android phone.

The program uses a TabActivity which contains a MapHandler / ItemizedOverlay. When a marker on the map is touched, the overlay onTap method is called. In this method, an alert dialog is displayed then, after a button is pressed, the view is switched to the view containing the details of the location. The view is switched by sending a message to the MapHandler which in turn uses a viewswitcher to swap them out. Again, there are no issues in the emulator, only on the phone.

Here is the stack trace that results:

10-24 15:49:33.055: ERROR/AndroidRuntime(10930): Uncaught handler: thread main exiting due to uncaught exception 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): java.lang.StackOverflowError 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.text.BoringLayout.draw(BoringLayout.java:356) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.widget.TextView.onDraw(TextView.java:3934) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.View.draw(View.java:5838) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1540) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.View.draw(View.java:5944) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.widget.FrameLayout.draw(FrameLayout.java:352) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1540) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.View.draw(View.java:5841) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.widget.FrameLayout.draw(FrameLayout.java:352) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1540) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.View.draw(View.java:5841) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.widget.FrameLayout.draw(FrameLayout.java:352) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1540) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.drawChild(ViewGroup.java:1538) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.View.draw(View.java:5841) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.widget.FrameLayout.draw(FrameLayout.java:352) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1896) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewRoot.draw(ViewRoot.java:1237) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewRoot.performTraversals(ViewRoot.java:1045) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.view.ViewRoot.handleMessage(ViewRoot.java:1504) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.os.Handler.dispatchMessage(Handler.java:99) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.os.Looper.loop(Looper.java:123) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at android.app.ActivityThread.main(ActivityThread.java:4077) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at java.lang.reflect.Method.invokeNative(Native Method) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at java.lang.reflect.Method.invoke(Method.java:521) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 10-24 15:49:33.360: ERROR/AndroidRuntime(10930): at dalvik.system.NativeStart.main(Native Method)

I'm a little suspicious of the sendmessage/viewswitcher method.

Anyone have any ideas?

A: 

This can happen if your view hierarchy is too deep. When drawing or dispatching events the view hierarchy is traversed recursively. You can usually do things like replace several nested LinearLayouts with RelativeLayouts to reduce the total depth of the tree.

adamp