Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
IgnitedAsyncTask sample
import com.github.ignition.core.tasks.IgnitedAsyncTask;
public class IgnitedAsyncTaskActivity extends Activity {
private SampleTask task;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
task = (SampleTask) getLastNonConfigurationInstance();
if (task == null) {
task = new SampleTask();
}
task.connect(this);
if (task.isRunning()) {
// show progress dialog or something
} else if (task.isPending()) {
task.execute();
}
}
@Override
public Object onRetainNonConfigurationInstance() {
return task;
}
@Override
protected void onDestroy() {
super.onDestroy();
task.disconnect();
}
public void updateViews(Void result) {
// ...
}
private static class SampleTask extends
IgnitedAsyncTask<IgnitedAsyncTaskActivity, Void, Void, Void> {
@Override
protected void onStart(IgnitedAsyncTaskActivity context) {
}
@Override
protected Void run(Void... params) throws Exception {
System.out.println("Working...");
return null;
}
@Override
protected void onSuccess(IgnitedAsyncTaskActivity context, Void result) {
context.updateViews(result);
}
@Override
protected void onError(IgnitedAsyncTaskActivity context, Exception error) {
super.onError(context, error);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.