title: Showing ProgressDialog during UI Thread operation in Android
body: <p>As I've asken on another question <a href="https://stackoverflow.com/questions/8079832/asynctask-and-getinstalledpackages-fail">HERE</a> it seems that the PackageManager.getInstalledPackages() doesn't play nice with Threading. As CommonsWare stated <a href="https://stackoverflow.com/questions/3455781/packagemanager-getinstalledpackages-returns-empty-list">HERE:</a>  </p>
  
  <blockquote>
    <p>Perhaps the PackageManager needs to be invoked on the main application
    thread, for some reason</p>
  </blockquote>
  
  <p>So having it on a thread gets undesired behavior, entering and exiting a few times in my Activity makes the list of displayed apps sometimes with items, sometimes empty. Having everything in the UI Thread works like a dream, loads fine everytime. The thing is, the user expects some sort of feedback and I need to provide one. As I start the activity, the screen remains black for 3-4-5-6 seconds (depending on the device and apps installed). How can I provide some sort of feedback ? I am thinking of a ProgressDialog but I don't know how can I start it. Thank you.</p>