Created
May 2, 2012 21:02
-
-
Save drapp/2580515 to your computer and use it in GitHub Desktop.
Android New SDK Feature May 2012
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
StackMobCommon.getStackMobInstance().count("user", new StackMobCountCallback() { | |
@Override public void success(long count) { | |
//count succeeded | |
} | |
@Override public void failure(StackMobException e) { | |
//count failed | |
} | |
}); |
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
StackMobQuery q = new StackMobQuery("user") | |
.fieldIsLessThan("age", 35) | |
.fieldIsGreaterThanOrEqualTo("follower_count", 20); | |
StackMobCommon.getStackMobInstance().count(q, new StackMobCountCallback() { | |
@Override public void success(long count) { | |
//count succeeded | |
} | |
@Override public void failure(StackMobException e) { | |
//count failed | |
} | |
}); |
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
boolean loggedIn = isLoggedIn(); | |
boolean loggedOut = isLoggedOut(); | |
String user = getLoggedInUser(); | |
boolean loggedIn = isUserLoggedIn("name"); |
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
StackMobQuery q = new StackMobQuery("user") | |
.fieldIsNotEqual("account_status", "closed") | |
.fieldIsNull("account") | |
.fieldIsNotNull("email"); | |
StackMobCommon.getStackMobInstance().get(q, new StackMobCallback() { | |
@Override public void success(String response) { | |
//GET succeeded | |
} | |
@Override public void failure(StackMobException e) { | |
//GET failed | |
} | |
}); |
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
public class MyUser extends StackMobUser { | |
private String email; | |
public MyUser(String username, String password) { | |
super(User.class, username, password); | |
} | |
public void setEmail(String email) { | |
this.email = email; | |
} | |
public String getEmail() { | |
return email; | |
} | |
} |
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
final MyUser user = new MyUser("AzureDiamond","hunter2"); | |
user.login(new StackMobCallback() { | |
@Override public void success(String response) { | |
//Login also fetches the rest of the user data | |
String email = user.getEmail(); | |
} | |
@Override public void failure(StackMobException e) { | |
//GET failed | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment