I am displaying one .gif in my activity A. When user presses one button user moves to activity b and same .gif is displaying there but I am getting "trying to use a recycled bitmap android.graphics.Bitmap" this error on my activity b.
I am displaying .gif from sd card and on onStop() I am setting imageview of activity a to null as well in activity A but I am not able to solve this issue.
Please help in this case.
//Log Cat
12-31 10:58:49.819: E/AndroidRuntime(20903): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap#405131c8
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.graphics.Canvas.throwIfRecycled(Canvas.java:955)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.graphics.Canvas.drawBitmap(Canvas.java:1044)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:325)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.widget.ImageView.onDraw(ImageView.java:854)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.View.draw(View.java:6880)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.View.draw(View.java:6883)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.View.draw(View.java:6883)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.widget.FrameLayout.draw(FrameLayout.java:357)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.View.draw(View.java:6883)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.widget.FrameLayout.draw(FrameLayout.java:357)
12-31 10:58:49.819: E/AndroidRuntime(20903): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1871)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewRoot.draw(ViewRoot.java:1542)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewRoot.performTraversals(ViewRoot.java:1269)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.view.ViewRoot.handleMessage(ViewRoot.java:1883)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.os.Handler.dispatchMessage(Handler.java:99)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.os.Looper.loop(Looper.java:130)
12-31 10:58:49.819: E/AndroidRuntime(20903): at android.app.ActivityThread.main(ActivityThread.java:3737)
12-31 10:58:49.819: E/AndroidRuntime(20903): at java.lang.reflect.Method.invokeNative(Native Method)
12-31 10:58:49.819: E/AndroidRuntime(20903): at java.lang.reflect.Method.invoke(Method.java:507)
12-31 10:58:49.819: E/AndroidRuntime(20903): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:894)
12-31 10:58:49.819: E/AndroidRuntime(20903): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
12-31 10:58:49.819: E/AndroidRuntime(20903): at dalvik.system.NativeStart.main(Native Method)
You can have check before recycling the bitmap, as like :
if (img != null && !img.isRecycled())
{
img.recycle();
img = null;
System.gc();
}
Here img is bitmap.
Try this type error is solved.
Try to find references of usage of the method recycle() in your code or in any library that you use. It indicates that someone is recycling a bitmap that is still being used which is not good. You can only safely call the recycle() method when you are absolutely sure that the given bitmap won't be necessary anymore.
It is usually a common problem when you are dealing with bitmap caches, not sure if that is your case.
Solution already provided here : Canvas: trying to use a recycled bitmap android.graphics.Bitmap in android
This one should work . Otherwise checkout the link for more solutions
if (mBitmap != null && !mBitmap.isRecycled()) {
mBitmap.recycle();
mBitmap = null;
}
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am getting this error when my app crashes due to Sliding Menu Library
12-31 14:02:54.319: E/AndroidRuntime(4121): java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.ListView.setupChild(ListView.java:1826)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.ListView.makeAndAddView(ListView.java:1793)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.ListView.fillSpecific(ListView.java:1337)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.ListView.layoutChildren(ListView.java:1620)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.AbsListView.onLayout(AbsListView.java:2087)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.onLayout(CustomViewAbove.java:476)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.View.layout(View.java:14817)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewGroup.layout(ViewGroup.java:4631)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1983)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1740)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.Choreographer.doFrame(Choreographer.java:544)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.os.Handler.handleCallback(Handler.java:733)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.os.Handler.dispatchMessage(Handler.java:95)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.os.Looper.loop(Looper.java:136)
12-31 14:02:54.319: E/AndroidRuntime(4121): at android.app.ActivityThread.main(ActivityThread.java:5001)
12-31 14:02:54.319: E/AndroidRuntime(4121): at java.lang.reflect.Method.invokeNative(Native Method)
12-31 14:02:54.319: E/AndroidRuntime(4121): at java.lang.reflect.Method.invoke(Method.java:515)
12-31 14:02:54.319: E/AndroidRuntime(4121): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-31 14:02:54.319: E/AndroidRuntime(4121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-31 14:02:54.319: E/AndroidRuntime(4121): at dalvik.system.NativeStart.main(Native Method)
can anyone help me in this issue. i tried to download fresh copy of library and use, but even then it is not solved. im compiling all my project dependent projects and app with android 5.0
Check/Organise your imports(ctrl + shift + o, in Eclipse) in CustomViewAbove.java and ensure that if LayoutParams have been used anywhere, they are from the package of android.widget.AbsListView.
Basically that is what your error is telling you:
12-31 14:02:54.319: E/AndroidRuntime(4121): java.lang.ClassCastException:
android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
If LayoutParams are being used at multiple places(other than line no. 476), then need to import both packages accordingly.
I am currently using 2 libraries in my Android project:
SlidingMenu: https://github.com/jfeinstein10/SlidingMenu
Android-PullToRefresh: https://github.com/chrisbanes/Android-PullToRefresh
With Android 4.x everything works right, but in Android 2.x I get a StackOverflow Exception.
I am not sure if it is an Android version issue or a hardware issue.
This is the log of the exception:
05-22 13:34:30.339: E/AndroidRuntime(15179): java.lang.StackOverflowError
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.Styled.measureText(Styled.java:430)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.Layout.measureText(Layout.java:1655)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.Layout.getLineMax(Layout.java:689)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.Layout.draw(Layout.java:340)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.BoringLayout.draw(BoringLayout.java:365)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.TextView.onDraw(TextView.java:4259)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6880)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.AbsListView.dispatchDraw(AbsListView.java:1492)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.ListView.dispatchDraw(ListView.java:3138)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6986)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.AbsListView.draw(AbsListView.java:2600)
05-22 13:34:30.339: E/AndroidRuntime(15179): at com.handmark.pulltorefresh.library.PullToRefreshListView$InternalListView.draw(PullToRefreshListView.java:281)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.buildDrawingCache(View.java:6642)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.onAnimationStart(ViewGroup.java:1259)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1505)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.support.v4.view.ViewPager.draw(ViewPager.java:1574)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at com.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:830)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.FrameLayout.draw(FrameLayout.java:357)
Can somebody help me to solve the issue?
Thank you!
You generally see this error when you have too many nested views - a problem which is exacerbated on older versions of Android.
However, I have also noticed that the slidingmenu lib can cause this on older versions of android (3.X or earlier). I used to see this error all the time and it was originating from the slidingmenu code - my own views were only nested 10-15 deep (not great, but not disastrous). I switched to the menu-drawer library https://github.com/SimonVT/android-menudrawer and the error disappeared.
Things to try...
Fire up the android device monitor or hierarchy viewer (http://developer.android.com/tools/debugging/debugging-ui.html) and have a look at your layouts. If there are any views deeper than say, 15-20 you might want to have a look at optimizing your layouts.
Try swapping out your sliding-menu lib for either google's own (in the support lib) or the one I mentioned above (which may be easier to swap as it follows a similar design to slidingmenu - it took me about an hour).
Good luck!
In my Android application's main Activity is a tabActivity and one of the tab contains another Tab activity. I load the 2nd activity with different views.
There is an error on loading the Application on the emulator.
03-11 16:28:46.463: E/AndroidRuntime(23736): FATAL EXCEPTION: main
03-11 16:28:46.463: E/AndroidRuntime(23736): java.lang.StackOverflowError
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.Styled.measureText(Styled.java:430)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.Layout.measureText(Layout.java:1655)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.Layout.getLineMax(Layout.java:689)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.Layout.draw(Layout.java:340)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.BoringLayout.draw(BoringLayout.java:365)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.TextView.onDraw(TextView.java:4150)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6880)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.AbsListView.dispatchDraw(AbsListView.java:1480)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.ListView.dispatchDraw(ListView.java:3138)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.ExpandableListView.dispatchDraw(ExpandableListView.java:229)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6986)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.AbsListView.draw(AbsListView.java:2584)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewRoot.draw(ViewRoot.java:1522)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewRoot.handleMessage(ViewR
Thrown when the depth of the stack of the running program exceeds some platform or VM specific limit. Typically, this will occur only when a program becomes infinitely recursive, but it can also occur in correctly written (but deeply recursive) programs.
More Details
Most likely in your child activity you are trying to load the first activity again, which loads the second activity, which again loads the first activity and so on, leading to recursion and your app dies because it reaches the memory limit, applied by the OS.
I have a class overriding ViewGroup. Here's my implementation of dispatchDraw:
#Override
protected void dispatchDraw(final Canvas canvas) {
super.dispatchDraw(canvas);
mViewBehind.drawShadow(mContent, canvas);
mViewBehind.drawFade(mContent, canvas, getPercentOpen());
mViewBehind.drawSelector(mContent, canvas, getPercentOpen());
}
However, sometimes I'm getting this StackOverflowError:
01-25 09:20:38.569: E/AndroidRuntime(15480): FATAL EXCEPTION: main
01-25 09:20:38.569: E/AndroidRuntime(15480): java.lang.StackOverflowError
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.text.BoringLayout.draw(BoringLayout.java:365)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.widget.TextView.onDraw(TextView.java:4225)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6880)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.widget.AbsListView.dispatchDraw(AbsListView.java:1586)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.widget.GridView.dispatchDraw(GridView.java:1948)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6986)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.widget.AbsListView.draw(AbsListView.java:2967)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6986)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.widget.FrameLayout.draw(FrameLayout.java:357)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.widget.ScrollView.draw(ScrollView.java:1423)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.widget.FrameLayout.draw(FrameLayout.java:357)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at com.ui.library.slidingmenu2.CustomViewAbove.dispatchDraw(CustomViewAbove.java:931)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at com.ui.library.slidingmenu2.CustomViewAbove.dispatchDraw(CustomViewAbove.java:931)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at com.ui.library.slidingmenu2.CustomViewAbove.dispatchDraw(CustomViewAbove.java:931)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.View.draw(View.java:6883)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.widget.FrameLayout.draw(FrameLayout.java:357)
01-25 09:20:38.569: E/AndroidRuntime(15480): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1921)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.ViewRoot.draw(ViewRoot.java:1528)
01-25 09:20:38.569: E/AndroidRuntime(15480): at android.view.Vie
The stack trace shows com.ui.library.slidingmenu2.CustomViewAbove.dispatchDraw(CustomViewAbove.java:931) (Which is super.dispatchDraw(canvas)) is getting called at least 4 times.
The exception only happens when I return to a certain activity which contains a ViewPager whose first Fragment contains a GridView, and only some times.
(BTW, what is a BoringLayout anyway?)
There must be too many layers, try to reduce your layout layer.
A BoringLayout is a very simple Layout implementation for text that fits on a single line and is all left-to-right characters.
I integrated ActionBarSherlock into my Android application. It is mostly working well, with one serious exception...
When running specifically on API Level 10 (which corresponds to Android 2.3.3), and only on that version, a StackOverflowError (shown below) is happening at a certain point when the user navigates between two particular activities. The call stack reveals that this error happens entirely within the Android framework, independent of my custom code.
The only reason I know it is related to ActionBarSherlock is that the error doesn't happen if I revert my changes to the activity classes so that they again inherit from the standard Activity base class instead of SherlockActivity, and revert to a non-Sherlock theme.
FATAL EXCEPTION: main
java.lang.StackOverflowError
at com.android.internal.util.ArrayUtils.emptyArray(ArrayUtils.java:107)
at android.text.SpannableStringInternal.getSpans(SpannableStringInternal.java:269)
at android.text.SpannedString.getSpans(SpannedString.java:25)
at android.text.Styled.drawUniformRun(Styled.java:67)
at android.text.Styled.drawDirectionalRun(Styled.java:322)
at android.text.Styled.drawText(Styled.java:381)
at android.text.Layout.drawText(Layout.java:1703)
at android.text.Layout.draw(Layout.java:505)
at android.text.BoringLayout.draw(BoringLayout.java:365)
at android.widget.TextView.onDraw(TextView.java:4431)
at android.view.View.draw(View.java:6880)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.widget.ScrollView.draw(ScrollView.java:1703)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.buildDrawingCache(View.java:6640)
at android.view.View.getDrawingCache(View.java:6428)
at android.view.ViewGroup.drawChild(ViewGroup.java:1571)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1921)
at android.view.ViewRoot.draw(ViewRoot.java:1526)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1262)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1863)
I just encountered a similar error when invalidateOptionsMenu() was being called twice in very quick succession (in onResume, and then in onPrepareOptionsMenu).
Once I removed the invalidateOptionsMenu() calls from onPrepareOptionsMenu, the issue went away. Maybe this isn't what's happening in your situation, but just thought I'd offer it as a possible solution.
The UI thread stack size on Android 2.x is smaller than Android 4.x. This means older versions are more prone to StackOverflowErrors. This explains why you only experience this on an older version.
The problem with ABS is that it automatically adds a few nested views to your layout (the main layout which holds the action bar). You can see these extra views by using Hierarchy Viewer.
If you already had a deep layout with many nested views, adding ABS probably added the extra views that filled up your stack.
What I suggest is that you simplify your layout and remove some of your extra views. There are a few tips on how to optimize layouts in the Android Developer Blog (by Romain Guy). If you save about 2-3 views, it should compensate on what ABS added and you should be fine.