1

my UI is pretty long to generate (about 20 seconds) for good reasons (calculating measurements of hundreds of views). I (think?) have to create them in the main thread, and then I run a progressdialog to make the user wait. Though, the main thread is already overloaded by the creation of the other calculations. Could I then create UI outside the main thread though I have to get measurements of several views?

Rocel
  • 1,029
  • 1
  • 7
  • 22
  • 2
    I think you do something wrong if you really have hunderds of views. You may want to use a ListView. – rekire Apr 09 '13 at 18:14
  • "my UI is pretty long to generate (about 20 seconds) for good reasons (calculating measurements of hundreds of views)" -- "calculating measurements of hundreds of views" should take a few milliseconds. Beyond the repeated recommendations of not having "hundreds of views" in the first place, use Traceview to figure out why it is taking you this long. – CommonsWare Apr 09 '13 at 18:18

1 Answers1

2

While some people say that they have got it to work, both Dianne and Romain say that you should not do this in a discussion, as the entire UI tree is single threaded. They say that it is not guaranteed to work, and should be avoided.

I can't come up with any scenario in which you'd need hundreds of Views instantiated and drawn at the same time. Perhaps you need to use a ListView, or implement some kind of lazy loading in your app.

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195