Skip to main content

Posts

Showing posts from December, 2010

Show a progress dialog when a thread is running

  We can easily show a progress dialog with Async task. But asyn task has its own drawbacks. There can be no ui's and the task can be executed only once.    Better way is to use a thread for lengthy processing and show a progess dialog in the ui thread. (I struggled quite a bit. My progress dialog would keep on spinning infinitely :-( ) e.g. //this is your main activity thread handler = new FeedReadHandler(); .... ..... pd = ProgessDialog.show(context,"Loading","Loading the file. please wait..."); Thread background = new Thread(new Runnable(){                              @Override                         public void run() {                             readFeed(n...