On Fri, Aug 19, 2011 at 1:35 PM, Snowak <[email protected]> wrote: > What a wonderful answer. It's a great idea to answer everything with > "you don't know what you're doing" and tell me to do it using worst > possible method. Yeah, let's freeze the UI thread. It's gonna be cool. > > You can't do the work on another thread, and the "work" is slow because each UI widget is actually a very sophisticated thing due to the way the framework works and the number of features it supports (think about layout recomputations, focus events, handling right-to-left and left-to-right layout, and more, much more things).
Really, anyone using hundreds of widgets (checkboxes, or whatever) and complaining that the UI is too slow should really get a clue-stick and start re-designing their code. > On 17 Sie, 23:17, Mark Murphy <[email protected]> wrote: > > On Wed, Aug 17, 2011 at 12:44 PM, Snowak <[email protected]> wrote: > > > I have hundreds of CheckBox widgets in my layout > > > > That is unlikely to be a good idea. > > > > > Obviously such heavy work should be done in separate thread, > > > > Not really. > > > > > The only thing that this thread actually can do is looping through the > > > list and posting the Runnable for every found checkbox. The problem is > > > that all those Runnables arrive in the UI thread almost at the same > > > time, thus they're all executed at once... The application behaves > > > exactly like I would run the above code in the UI thread - everything > > > freezes. A possible solution is sleeping for some miliseconds after > > > each checkbox so the Runnable can be executed and the UI will have > > > time to process the events... but it's more like a hack. > > > > > How can I solve this problem? > > > > Redesign your UI to not have "hundreds of CheckBox widgets" at once. > > Or, update them on the main application thread and hope for the best. > > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com| > http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > > > _Android Programming Tutorials_ Version 3.9 Available! > > -- > 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 > -- 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

