Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7194083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:18:00+00:00 2026-05-28T20:18:00+00:00

I am working on an internal app that displays the daily schedule for a

  • 0

I am working on an internal app that displays the daily schedule for a given conference room on a timeline. Every minute, I hit a web service and get info back for all of the day’s appointments, and I use that data to create custom “timeline block” views that show the time of the meeting, the client, etc. I then remove all appointments from the timeline and refresh it with the new data. The custom views I am using consist of nothing more than a LinearLayout with 3 TextViews inside it. I suppose I should note that the layout for the activity is pretty complex, and some views are nested about 7 layers deep.

Everything runs great for about 2-3 days, and then the app will crash. I made it so that it would hit the web service every 3 seconds, and now the crash will happen about every 2.5 hours. What gets me is that the exception that is thrown does not even point to anything in my code. Exception is below:

FATAL EXCEPTION: main
java.lang.ClassCastException: java.lang.String
   at android.text.Styled.drawDirectionalRun(Styled.java:283)
   at android.text.Styled.measureText(Styled.java:430)
   at android.text.Layout.measureText(Layout.java:1655)
   at android.text.Layout.getLineMax(Layout.java:689)
   at android.text.Layout.getLineWidth(Layout.java:671)
   at android.widget.TextView.desired(TextView.java:5037)
   at android.widget.TextView.onMeasure(TextView.java:5083)
   at android.view.View.measure(View.java:8171)
   at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
   at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
   at android.view.View.measure(View.java:8171)
   at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
   at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
   at android.view.View.measure(View.java:8171)
   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
   at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
   at android.view.View.measure(View.java:8171)
   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
   at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
   at android.view.View.measure(View.java:8171)
   at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
   at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4627)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
   at dalvik.system.NativeStart.main(Native Method)

If I am incorrectly casting a String (which I’m pretty sure I’m not), how is it that it wouldn’t be caught until it’s that deep in native code? I’m at a loss here. Is it possible this is an internal Android bug?

Another thing that might help: another time when this app crashed, it gave the same ClassCastException, but in a different spot. It happened in the BoringLayout.isBoring function, which is also something that is never touched in my code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:18:01+00:00Added an answer on May 28, 2026 at 8:18 pm

    So, it turns out that the problem all along was that Android leaks memory when disposing (improperly) of TypeFace objects. I was creating a new TypeFace for every text label, and each minute the timeline blocks were being repopulated as the timeline was updated.

    The solution is to create the TypeFaces that are reused so that they are globally accessible. I put them in the Application class since all my Activities can access it. That way Android only has to dispose of a few objects instead of hundreds. It doesn’t fix the internal issue of course, but it is a workaround. The issue may be fixed as of ICS, but I’m not sure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a WP7 app that displays some times on one page.
I'm currently working on an app for the Android OS that displays some data.
I'm developing a Facebook app for the web application that I'm working on. I
I've been working on an internal site that has Apache / PHP running. I
I have a rails app that is working fine except for one thing. When
I'm going to be creating an internal app for the iPhone and iPad that
I am new to rails, and working on an internal content management app. I
The app I am working on needs to read a JSON file that may
I'm working with a legacy Java app that has no logging and just prints
I have created an App that gets data from Web Services on an In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.