I am working on one Android application. in my one activity i am using PullToRefreshListView. sometime i am getting java.lang.StackOverflowError Exception on my activity. i have tried to fix it and i also searched on google too but not getting perfect solution.
i have two activity with same functionality with PullToRefreshListView with same data. but i am getting this Exception on only one activity. other activity is working fine.
Here is my full StakeTrace.
Please help me. Sorry for my poor English.
Thankx in advance.
java.lang.StackOverflowError
at android.text.TextLine.handleText(TextLine.java:749)
at android.text.TextLine.handleRun(TextLine.java:972)
at android.text.TextLine.measureRun(TextLine.java:416)
at android.text.TextLine.measure(TextLine.java:295)
at android.text.TextLine.metrics(TextLine.java:269)
at android.text.Layout.getLineExtent(Layout.java:942)
at android.text.Layout.draw(Layout.java:405)
at android.text.BoringLayout.draw(BoringLayout.java:400)
at android.widget.TextView.onDraw(TextView.java:5038)
at android.view.View.draw(View.java:10982)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10985)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.widget.ListView.drawChild(ListView.java:3223)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:2092)
at android.widget.ListView.dispatchDraw(ListView.java:3218)
at com.handmark.pulltorefresh.library.PullToRefreshListView$InternalListView.dispatchDraw(PullToRefreshListView.java:293)
at android.view.View.draw(View.java:10985)
at android.widget.AbsListView.draw(AbsListView.java:3398)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10985)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10985)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10985)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10985)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:928)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10985)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10985)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at android.view.View.getDisplayList(View.java:10421)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10985)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2126)
at android.view.View.getDisplayList(View.java:10421)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:842)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1943)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1667)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Increase Thread Stack Size (-Xss) Increasing the stack size can be useful, for example, when the program involves calling a large number of methods or using lots of local variables. This will set the thread's stack size to 4 mb which should prevent the JVM from throwing a java. lang. StackOverflowError .
To handle StackoverFlowError, you should carefully inspect the stack trace to detect any repeating call patterns in your code. These indicate recursive calls to your code or function. Some traits of recursion: Large thread stacks that appear to repeat.
A stack overflow is a type of buffer overflow error that occurs when a computer program tries to use more memory space in the call stack than has been allocated to that stack.
The most common cause of StackOverFlowError is excessively deep or infinite recursion.
One of the reason why StackOverflow Exception occurs is due to nesting of Layouts. But this issue will occur only upto 4.0 and below, beyond that stackoverflow exception will not occur much. Check if you have multiple nested layouts in your xml to avoid this issue. Please post your xml in order to help further.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With