Created
December 2, 2017 21:07
-
-
Save hiranya911/34b6ebbf4460c091b8bf0544d1877292 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.api.core.ApiFuture; | |
import com.google.api.core.ApiFutureCallback; | |
import com.google.api.core.ApiFutures; | |
@Deprecated | |
public void addTaskCallbacks(Task<String> task) { | |
task.addOnSuccessListener(new OnSuccessListener<String>() { | |
@Override | |
public void onSuccess(String result) { | |
System.out.println("Operation completed with result: " + result); | |
} | |
}); | |
task.addOnFailureListener(new OnFailureListener() { | |
@Override | |
public void onFailure(Exception e) { | |
System.out.println("Operation failed with error: " + e); | |
} | |
}); | |
} | |
public void addFutureCallbacks(ApiFuture<String> future) { | |
ApiFutures.addCallback(future, new ApiFutureCallback<String>() { | |
@Override | |
public void onSuccess(String result) { | |
System.out.println("Operation completed with result: " + result); | |
} | |
@Override | |
public void onFailure(Throwable t) { | |
System.out.println("Operation failed with error: " + t); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment