'Adding a huge amount of views

I need to add a huge amount of buttons to the linear layout in a scroll box (around 1000). But it's taking a very long time so I want it to be in the background. I tried using Handler and AsyncTask, but the app freezes upon adding buttons. How can I put button adding task in the background, so I could interact with app while buttons are loading?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source