Hi All,
I have hit a bit of a snag on Android with regards to Querying a database.
I have set up an account with Parse.com which seems a very reasonable and clever solution to server hosting as a new developer.
In my set up I have 3 tables (or as Parse call them, classes) - Users, Cards, and Payer_Cards. All Users have a unique objectID, all Cards have a unique objectID and Player_Cards is a lookup between the two, containing Player ID and Card ID (not all players have all cards).
The below logic is my attempt, but for some reason I cant figure it out. I can get the Card IDs listed based on all cards against the player ID (currentUser), but when I try to expand this to look at table 3 (Cards) it all falls apart.
public void cardList(List<ParseObject> cardList){
StringBuilder cards = new StringBuilder();
for(int i=0; i<cardList.size(); i++){
cards.append("Card:");
ParseObject[] cList = cardList.toArray(new ParseObject[0]);
String cardId = cList[i].getString("CARD_ID");
ParseQuery<ParseObject> query = ParseQuery.getQuery("CARDS");
query.whereEqualTo("objectId", cardId);
query.getInBackground(cardId, new GetCallback<ParseObject>() {
public void done(ParseObject object, com.parse.ParseException e) {
if (e == null) {
cards.append(object.getString("CARD_NAME"));
} else {
}
}
});
}
TextView CardsList = (TextView) findViewById(R.id.CardsList);
CardsList.setText(cards.toString());
}
The current error in my code is that "cards" isn't recognised within the if block.
Any assistance on this is greatly appreciated - I have exhausted all of my ides of how to get around this.
Thanks