我在我的 Android 项目中使用Bolts 框架。文档看了好几遍,还是对 continueWith() 和 onSuccess() 的区别感到困惑,因为回调方法和返回值都是一样的。例如,
Task task = ParseGeoPoint.getCurrentLocationInBackground(10*1000);
这两种方法有什么区别?
task.onSuccess(new Continuation<ParseGeoPoint, Object>() {
@Override
public Object then(Task<ParseGeoPoint> task) throws Exception {
Log.d(TAG, "task done");
return null;
}
});
task.continueWith(new Continuation<ParseGeoPoint, Object>() {
@Override
public Object then(Task<ParseGeoPoint> task) throws Exception {
Log.d(TAG, "task done");
return null;
}
});