Reputation: 23
I don't know about parse and I want to learn it.I want to know how can I get the latest updated parse object in parse.I tried to use get first in background but I think there is a problem in my ParseQuery.Please provide me the right way of query to get the latest object I just pushed on the parse cloud back.
ParseQuery<ParseObject> query=ParseQuery.getQuery("RBSE");
query.whereEqualTo("roomA","900");
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject objectLatest, ParseException e) {
if(e==null){
}
else{
}
}
}
Upvotes: 0
Views: 3248
Reputation: 16874
To get the most recently created/modified, simply sort descending by the "updatedAt" field (it is built-in).
ParseQuery<ParseObject> query = ParseQuery.getQuery("RBSE");
query.orderByDescending("updatedAt");
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (object == null) {
Log.d("RBSE", "The getFirst request failed.");
} else {
// got the most recently modified object... do something with it here
}
}
});
Upvotes: 5