Ok thanks.
Now the good news is that when i changed my code to
setText(getText(aResID).toString() + anotherString) i don't have any more
the same trace (but as it was not easily reproductible, it is difficult to
say it is completly solved).
The bad news is that when i add also these 2 following lines in my
TabActivity.onCreate to change the tab color:
tabHost.setBackgroundColor(Color.BLACK);
tabHost.getTabWidget().setBackgroundColor(getResources().getColor(R.color.dark_blue));
I have now a systematic crash at startup :( (no mention of CharSequence in
the backtrace)
Does changing the color has anything to do this layout nest level??
Particularly the "tabHost.setBackgroundColor(Color.BLACK);" seems to cause
the crash.
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): java.lang.StackOverflowError
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.text.Layout.measureText(Layout.java:1600)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.text.Layout.getLineMax(Layout.java:654)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.text.Layout.draw(Layout.java:310)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.text.BoringLayout.draw(BoringLayout.java:356)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.widget.TextView.onDraw(TextView.java:3934)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.View.draw(View.java:5838)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.View.draw(View.java:5841)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.View.draw(View.java:5841)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.View.draw(View.java:5944)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.View.draw(View.java:5841)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.View.draw(View.java:5841)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.View.draw(View.java:5841)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1892)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewRoot.draw(ViewRoot.java:1237)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1504)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.os.Handler.dispatchMessage(Handler.java:99)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.os.Looper.loop(Looper.java:123)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.app.ActivityThread.main(ActivityThread.java:3948)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
java.lang.reflect.Method.invokeNative(Native Method)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
java.lang.reflect.Method.invoke(Method.java:521)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
dalvik.system.NativeStart.main(Native Method)
2010/6/9 Zsolt Vasvari <[email protected]>
> You are using a CharSequence, I see that from your stack trace.
>
> I have a similar modularity issue as you do. Unfortunately, one of my
> in-tab activity is also used standalone, so it's not most practical to
> make it a View. It's possible, but would involve some code
> duplication. Luckily, for me, removing a couple of layers combined
> with the .toString() trick was enough to prevent the crash on 1.5.
>
>
> On Jun 8, 3:45 pm, Thierry Legras <[email protected]> wrote:LuLu
> > Thanks all for your help.
> >
> > Indeed, i am using Tabs with activities! I don't like the idea to switch
> to
> > views-in-tabs design :( i found that the activities-in-tab approach
> allows
> > to have a better modularity as my tabs are managing different data. Also
> tab
> > content does not need to be initialized as long as the tab is not
> selected.
> >
> > I am first trying to follow your advice to pass only string in setText,
> and
> > found only one use of CharSequence:
> >
> > setText(getText(aResID) + anotherString)
> >
> > Does toString() will help here? I admit it is not clear to me what
> happens
> > when a String is added to a CharSequence.
> >
> > Anothing that might help, at some time i want to switch from one tab to
> > another. So far i made a little hack: i started a new instance of my
> > tabactivity on top (with target tab selected), and finish the current
> > activity. I noticed the crashes often happens after that. Maybe changing
> > that design will also help to reduce stackoverflow risks.
> >
> > Thierry.
> >
> > 2010/6/8 Zsolt Vasvari <[email protected]>
> >
> >
> >
> >
> >
> > > Are you using the tab widget by any chance? Because adding activities
> > > inside tabs will take up at least 5 layers in your UI hierarchy. I am
> > > struggling with the same issue which only crashes on 1.5, 1.6+ is
> > > fine.
> >
> > > On Jun 7, 9:16 pm, Thierry Legras <[email protected]> wrote:
> > > > Hi,
> >
> > > > I am facing rare StackOverflowError in my application during UI
> redraw.
> > > Does
> > > > it mean memory is exhausted? How can i fix this? And finally how can
> i be
> > > > sure the issue will be definitevly fixed??
> >
> > > > Any advice would be welcome :)
> > > > Thierry.
> >
> > > > Here is the backtrace:
> >
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775):
> java.lang.StackOverflowError
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at android.text.method.
> >
> > >
> ReplacementTransformationMethod$ReplacementCharSequence.getChars(ReplacementTransformationMethod.java:151)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.TextUtils.getChars(TextUtils.java:69)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Layout$Ellipsizer.getChars(Layout.java:1778)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.TextUtils.getChars(TextUtils.java:69)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.graphics.Paint.measureText(Paint.java:1016)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Styled.each(Styled.java:124)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Styled.foreach(Styled.java:249)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Styled.measureText(Styled.java:371)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Layout.measureText(Layout.java:1600)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Layout.getLineMax(Layout.java:654)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Layout.getLineMax(Layout.java:628)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Layout.getHorizontal(Layout.java:552)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Layout.getHorizontal(Layout.java:513)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.text.Layout.getPrimaryHorizontal(Layout.java:498)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.widget.TextView.getFocusedRect(TextView.java:3962)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.view.FocusFinder.findNextFocus(FocusFinder.java:72)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.view.ViewGroup.focusSearch(ViewGroup.java:473)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.view.ViewGroup.focusSearch(ViewGroup.java:475)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > > android.view.ViewGroup.focusSearch(ViewGroup.java:475)
> > > > 06-07 15:11:20.318 E/AndroidRuntime(22775): at
> > > >
>
(snip)
--
Thierry.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en