public abstract class LogInCallback<T extends AVUser> extends AVCallback<T>
A LogInCallback is used to run code after logging in a user.
The easiest way to use a LogInCallback is through an anonymous inner class. Override the done function to specify what the callback should do after the login is complete. The done function will be run in the UI thread, while the login happens in a background thread. This ensures that the UI does not freeze while the save happens.
For example, this sample code logs in a user and calls a different function depending on whether the login succeeded or not.
AVUser.logInInBackground("username", "password", new LogInCallback() {
public void done(AVUser user, AVException e) {
if (e == null && user != null) {
loginSuccessful();
} else if (user == null) {
usernameOrPasswordIsInvalid();
} else {
somethingWentWrong();
}
}
});
| Constructor and Description |
|---|
LogInCallback() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
done(T user,
AVException e)
Override this function with the code you want to run after the save is complete.
|
protected void |
internalDone0(T returnValue,
AVException e) |
internalDone, internalDone, mustRunOnUIThreadpublic abstract void done(T user, AVException e)
user - The user that logged in, if the username and password is valid.e - The exception raised by the login.protected final void internalDone0(T returnValue, AVException e)
internalDone0 in class AVCallback<T extends AVUser>Copyright © 2017. All rights reserved.