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

Retry a Bash command with timeout

bash loops timeout

How to retry a bash command until its status is ok or until a timeout is reached?

Code equivalent for Html.EditorFor()

asp.net-mvc asp.net-mvc-2 html-helper partial-views editorfor

Anyone know how you can call a functional equivalent to Html.EditorFor() from the Controller?

Solr unable to reindex due to undefined field type

ruby-on-rails solr sunspot

I've inhereted a rails app that uses Solr, which is new to me. All I want to do for now is to get the site running locally. I've installed solar, but when I try to get it running on the app, I have

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.