Sunday 26 February 2012

Android: run time-consuming work in another thread

Many times you want to run time-consuming work in another thread instead of main thread because UI will stop response if you run it in main thread, and the user will frustrate.

It is easy to implement:

Just wrap up the time-consuming code with


new Thread(new Runnable() {
  public void run() {

  //... time-consuming work

  }
}).start();


No comments:

Post a Comment