Publish progress - PerfectCarl/androidannotations GitHub Wiki

Since AndroidAnnotations 1.0

Publish progress made easy

It's actually quite easy to deal with progress reports when you let AndroidAnnotations handle thread related boilerplate code.

Here is a simple example:

@EActivity
public class MyActivity extends Activity {

  @Background
  void doSomeStuffInBackground() {
    publishProgress(0);
    // Do some stuff
    publishProgress(10);
    // Do some stuff
    publishProgress(100);
  }

  @UiThread
  void publishProgress(int progress) {
    // Update progress views
  }

}