Processing large Spanned objects with TextView (setText)

Well, to give you a bit of history on this project - I'm parsing a string that's about 100k in a child thread, and returning the Spanned object from Html.fromHtml().

The issue is when it returns to the main thread - when trying to setText using the Spanned that was just created in another thread, it takes quite a long time processing it from a Spanned object into a displayable format (setText).

I would normally process this in the child thread, but unfortunately, since this is related to the UI, I can't - has to be on the main thread. So, my question is whether there is a way to process the Spanned into something easily interpreted by the setText, so that it doesn't spend a lot of time on the main thread processing it after the child thread has finished.

testQuestionsExplanations.setText(spannedExplanationsObj);

My biggest issue is that it locks the main thread down doing this.

Answers


I found a work around for my problem.

Instead of sending the whole Spanned object and getting it processed onto the TextView all at once, I'm sending smaller pieces, and just appending them to the TextView.

This way my ProgressDialog doesn't lock up completely - it's jerky, but it's better than not moving at all.


Need Your Help

Getting screenshot from a LinearLayout

android android-layout android-linearlayout

I have a LinearLayout that contains a lot of sub LinearLayouts which contain TextViews. I want to get a screenshot from the parent LinearLayout to get a full view of my "Receipt". So I tried to do ...

Convert string “dd month_full_name year” to string “yyyy/mm/dd” with .NET

c# .net string transformation

Is there anything standard in C# to transform in to out. I don't mind ad hoc routine either.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.