Created
July 31, 2012 03:23
-
-
Save marialecodes/3213241 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
package com.xxx; | |
import com.parse.CountCallback; | |
import com.parse.ParseException; | |
import com.parse.ParseQuery; | |
import com.parse.ParseUser; | |
public class ParseList { | |
// getGames() Busca partidas donde el "player1" o "player2" sea el usuario actual. | |
public void getGames() { | |
ParseUser currentUser = ParseUser.getCurrentUser(); | |
ParseQuery gamesQuery = new ParseQuery("Game"); | |
gamesQuery.whereEqualTo("player1", currentUser); | |
ParseQuery gamesQuery1 = new ParseQuery("Game"); | |
gamesQuery1.whereEqualTo("player2", currentUser); | |
List<ParseQuery> queries = new ArrayList<ParseQuery>(); | |
queries.add(gamesQuery); | |
queries.add(gamesQuery1); | |
ParseQuery mainQuery = ParseQuery.or(queries); | |
mainQuery.findInBackground(new FindCallback() { | |
public void done(List<ParseObject> games, ParseException e) { | |
if (games == null){ | |
} | |
else { | |
showGames(games); // games es la lista obtenida de objetos "Game" | |
} | |
} | |
}); | |
} | |
public void showGames(int count){ | |
// ?? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment