private void localQuery(){ ParseQuery<Kid> lQuery = ParseQuery.getQuery(Kid.class).fromLocalDatastore(); lQuery.orderByAscending("createdAt"); lQuery.findInBackground(new FindCallback<Kid>() { @Override public void done(List<Kid> list, ParseException e) { if (e == null) { kidArrayList.clear(); kidArrayList.addAll(list); fillHashMap(); adapter = new AddAttendanceAdapter(AddAttendance.this,kidArrayList,activityMap); listView.setAdapter(adapter); listView.invalidate(); } } }); }
private void localQuery(){ ParseQuery<Kid> query = ParseQuery.getQuery(Kid.class).fromLocalDatastore(); query.orderByAscending("createdAt"); query.findInBackground(new FindCallback<Kid>() { @Override public void done(List<Kid> list, @Nullable ParseException e) { if (e == null && list.size()!=0) { kidArrayList.clear(); kidArrayList.addAll(list); applyAttendanceToKids(); adapter.notifyDataSetChanged(); listView.invalidate(); } } }); }
private void serverQuery() { ParseQuery<Kid> query = ParseQuery.getQuery(Kid.class); query.orderByAscending("createdAt"); query.findInBackground(new FindCallback<Kid>() { @Override public void done(List<Kid> list, @Nullable ParseException e) { if (e == null){ kidArrayList.clear(); kidArrayList.addAll(list); Kid.pinAllInBackground(kidArrayList); applyAttendanceToKids(); adapter.notifyDataSetChanged(); listView.invalidate(); }else if(checkConnection()){ toaster("Error getting data from Server\nWorking offline!","l"); } } }); }
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) { ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME); pQuery.whereContainedIn(CONFIG_USERNAME, usernames); pQuery.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> arg0, ParseException arg1) { if (arg0 != null) { List<EaseUser> mList = new ArrayList<EaseUser>(); for (ParseObject pObject : arg0) { EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME)); ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR); if (parseFile != null) { user.setAvatar(parseFile.getUrl()); } user.setNick(pObject.getString(CONFIG_NICK)); EaseCommonUtils.setUserInitialLetter(user); mList.add(user); } callback.onSuccess(mList); } else { callback.onError(arg1.getCode(), arg1.getMessage()); } } }); }
private void loadParseData(String Id){ ParseQuery<ParseObject> query = ParseQuery.getQuery(EventTable); query.whereEqualTo("PhotoAlbumId", Id); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> productParseList, com.parse.ParseException e) { if (e == null) { if(productParseList.size() > 0){ eventList.addAll(productParseList); eventAdapter = new PhotosAdapter(mContext, eventList); gridView.setAdapter(eventAdapter); }else{ Toast.makeText(mContext,"Danh sách trống", Toast.LENGTH_SHORT).show(); } } else { e.printStackTrace(); LoggerFactory.e("loadParseData", "Error: " + e.getMessage()); } } }); }
private void loadParseData(){ ParseQuery<ParseObject> query = ParseQuery.getQuery(tableName); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> productParseList, com.parse.ParseException e) { if (e == null) { if(productParseList.size() > 0){ eventList.addAll(productParseList); eventAdapter = new VideoAdapter(mContext, eventList); gridView.setAdapter(eventAdapter); }else{ Toast.makeText(mContext,"Danh sách trống", Toast.LENGTH_SHORT).show(); } } else { e.printStackTrace(); LoggerFactory.e("loadParseData", "Error: " + e.getMessage()); } } }); }
private void verifyOrganization(){ final String enteredText = orgName.getText().toString().trim(); final RefreshingDialog rd = new RefreshingDialog(this); rd.createRefreshingDialog(); ParseQuery<Organization> query = ParseQuery.getQuery(Organization.class); query.whereEqualTo("name", enteredText); query.findInBackground(new FindCallback<Organization>() { @Override public void done(List<Organization> objects, ParseException e) { if(objects.isEmpty()){//new group createGroupAlert(enteredText); rd.stop(); }else{ joinGroupAlert(objects.get(0)); rd.stop(); } } }); }
private void loadData() { ParseQuery<UserInfo> query = ParseQuery.getQuery(UserInfo.class); query.orderByDescending("score").setLimit(10); query.findInBackground(new FindCallback<UserInfo>() { @Override public void done(List<UserInfo> objects, ParseException e) { list.addAll(objects); runOnUiThread(new Runnable() { @Override public void run() { adapter.notifyDataSetChanged(); } }); } }); }
public void localTeamList() { // Query backend ParseQuery<ParseObject> query = ParseQuery.getQuery("T" + teamNumber); query.fromLocalDatastore().findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> list, ParseException e) { // No exception, query successful if (e == null) { teams.clear(); Collections.reverse(list); for (ParseObject object : list) { if (object.getString("team").equals("")) continue; Team team = new Team(object.getString("team"), object.getString("region"), object.getString("school"), object.getString("teamName"), object.getObjectId()); teams.add(team); } } adapter.notifyDataSetChanged(); refresh.setRefreshing(false); } }); }
public void getNodes(final Callback<List<Node>> cb) { if (nodes == null) { getNodeRelation() .getQuery() .orderByAscending(KEY_ORDER) .findInBackground(new FindCallback<Node>() { @Override public void done(List<Node> objects, ParseException e) { if (e != null) { cb.error(new Error(e.getMessage(), e.getCode())); e.printStackTrace(); } else { nodes = objects; cb.done(nodes); } } }); } else { cb.done(nodes); } }
public void retrieveChannels(){ ParseQuery query = new ParseQuery("Channel"); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> channels, ParseException e) { if (e == null) { Log.e(LOG_TAG, "Retrieved channels. Size: "+channels.size()); if (channels.size() > 0) { mRetrievedChannels = (List) channels; } } else { Log.e(LOG_TAG, "Error: " + e.getMessage()); } } }); }
public void addBullshITBank(final String NewNumber){ if(NewNumber.length()<6){ Toast.makeText(mContext, getResources().getString(R.string.too_short), Toast.LENGTH_LONG).show(); }else{ ParseQuery<ParseObject> query = ParseQuery.getQuery("BullshITBankDB"); query.whereStartsWith("phone", NewNumber); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> parseObjects, ParseException e) { if (parseObjects.size() > 0) { Toast.makeText(mContext, getResources().getString(R.string.duplicate), Toast.LENGTH_LONG).show(); } else { FragmentManager fragmentManager = getSupportFragmentManager(); DialogFragment ConfirmDialog = AddNewConfirmDialog.newInstance(NewNumber,GUID); ConfirmDialog.show(fragmentManager,"confirmdialog"); } } }); } }
public void loadMoreData(Integer currentCount){ if(!isUpdating){ notifyUpdateStart(); ParseQuery<SnackEntry> query = ParseQuery.getQuery(SnackEntry.class); query.orderByDescending("createdAt"); query.whereEqualTo("owner", targetUser); query.setLimit(10); query.setSkip(currentCount); query.findInBackground(new FindCallback<SnackEntry>() { @Override public void done(List<SnackEntry> moreSnacks, ParseException e) { if (e == null) { snacks.addAll(moreSnacks); } notifyUpdateComplete(e); } }); } }
public static void saveUserLiked(final String userId) { ParseQuery<ParseObject> query = new ParseQuery<>(TABLE_NAME); query.whereEqualTo(COLUMN_TO_USER, ParseUser.getCurrentUser().getObjectId()); query.whereEqualTo(COLUMN_BY_USER, userId); query.whereEqualTo(COLUMN_TYPE, TYPE_LIKED); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> list, ParseException e) { ParseObject action = null; if(e == null && list.size() > 0) { // we have a match and want to match users together ParseObject otherAction = list.get(0); otherAction.put(COLUMN_TYPE, TYPE_MATCHED); otherAction.saveInBackground(); action = createAction(userId, TYPE_MATCHED); } else { action = createAction(userId, TYPE_LIKED); } action.saveInBackground(); } }); }
public static void getMatches(final ActionDataCallbacks callbacks) { ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(TABLE_NAME); query.whereEqualTo(COLUMN_BY_USER, ParseUser.getCurrentUser().getObjectId()); query.whereEqualTo(COLUMN_TYPE, TYPE_MATCHED); query.orderByDescending(COLUMN_UPDATED_AT); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> list, ParseException e) { if(e == null) { List<String> ids = new ArrayList<String>(); for(ParseObject object : list) { ids.add(object.getString(COLUMN_TO_USER)); } if(callbacks != null) { callbacks.onFetchedMatches(ids); } } } }); }
private void addFriendCheckmarks() { mFriendsRelation.getQuery().findInBackground(new FindCallback<ParseUser>() { @Override public void done(List<ParseUser> friends, ParseException e) { if (e == null) { // list returned - look for a match for (int i = 0; i < mUsers.size(); i++) { ParseUser user = mUsers.get(i); for (ParseUser friend : friends) { if (friend.getObjectId().equals(user.getObjectId())) { mGridView.setItemChecked(i, true); } } } } else { Log.e(TAG, e.getMessage()); } } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ParseQuery<ParseObject> query = ParseQuery.getQuery("EventData"); query.orderByDescending("createdAt"); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> events, ParseException e) { if (e == null) { mEvents = events; EventAdapter adapter = new EventAdapter(getListView().getContext(), mEvents); setListAdapter(adapter); } else { } } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ParseQuery<ParseObject> query = ParseQuery.getQuery("event_user"); query.whereEqualTo("userID", ParseUser.getCurrentUser().getObjectId() ); query.whereEqualTo("isPart", true); query.orderByDescending("createdAt"); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> events, ParseException e) { if (e == null) { mParticipatedEvents= events; ProfileListAdapter adapter = new ProfileListAdapter(getListView().getContext(), mParticipatedEvents); setListAdapter(adapter); } else { } } }); }
private void fetchMyListings() { ParseQuery<ParseObject> query = new ParseQuery<>( ParseTables.Listings.LISTINGS); query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE); query.whereEqualTo(ParseTables.Listings.OWNER_NAME, ParseUser.getCurrentUser().getString(ParseTables.Users.NAME)); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(final List<ParseObject> parseObjects, ParseException e) { if (e == null) { doneFetching(parseObjects); } else { loader.setVisibility(View.GONE); Toast.makeText(getActivity(), "Please connect to the Internet", Toast.LENGTH_SHORT).show(); } } }); }
/** * Exports the snack entries for a specified user. The current user must have access to the * specified user's entries for this method to work. * * @param user The user for which to export entries. * @param mode Export mode (EXPORT_LAST_24_HOURS, EXPORT_LAST_48_HOURS, EXPORT_EVERYTHING). * @param callback The callback to invoke upon completion. The callback will specify the * export file. */ public static void export(final ParseUser user, int mode, final Callback callback){ getSnacks(user, mode, new FindCallback<SnackEntry>() { @Override public void done(List<SnackEntry> objects, ParseException e) { File file = null; if(e == null){ try{ file = generateCSV(user, objects); } catch(IOException ioe){ file = null; } } callback.callback(file); } }); }
/** * Refreshes the SnackList. That is, queries Parse for the current user's SnackEntrys and * repopulates the SnackList with the result. If the query fails, the SnackList remains * unchanged. * * @param callback Optional. The callback to invoke after completion. */ public void refresh(@Nullable final FindCallback<SnackEntry> callback){ Log.d(TAG, "Refresh start"); notifyUpdateStart(); ParseQuery<SnackEntry> query = ParseQuery.getQuery(SnackEntry.class); query.orderByDescending("createdAt"); query.whereEqualTo("owner", targetUser); query.setLimit(10); query.findInBackground(new FindCallback<SnackEntry>() { @Override public void done(List<SnackEntry> refreshedSnacks, ParseException e) { if (e == null) { snacks.clear(); snacks.addAll(refreshedSnacks); } if (callback != null) { callback.done(refreshedSnacks, e); } notifyUpdateComplete(e); } }); }
private void loadUserList() { ParseUser.getQuery().whereNotEqualTo("username", user.getUsername()).findInBackground(new FindCallback<ParseUser>() { @Override public void done(List<ParseUser> objects, ParseException e) { if (objects != null) { if (objects.size() == 0) System.out.println("No user found"); userList = new ArrayList<>(objects); ListView list = (ListView) findViewById(R.id.userList); list.setAdapter(new UserAdapter(UserList.this)); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { nameFromList = userList.get(i).getUsername(); System.out.println("name from list:" + nameFromList); startActivity(new Intent(UserList.this, Chat.class)); finish(); } }); } else { System.out.println("exception detected while loading user list"); e.printStackTrace(); } } }); }
private void dietitianSearch(final String userId) { ParseQuery<ParseUser> query = ParseQuery.getQuery("_User"); query.whereEqualTo("objectId", userId); query.findInBackground(new FindCallback<ParseUser>() { @Override public void done(List<ParseUser> objects, ParseException e) { if (e == null) { if (!objects.isEmpty()) { ParseUser result = objects.get(0); ParseUser.getCurrentUser().put("myDietitian", result); giveAccess(result); } else Toast.makeText(cont, "User not found", Toast.LENGTH_LONG).show(); } else Log.e("SEARCH ERROR", "ERROR IN SEARCHING"); } }); }
private void populateMessageHistory() { String[] userIds = {currentUserId, recipientId}; ParseQuery<ParseObject> query = ParseQuery.getQuery("ParseMessage"); query.whereContainedIn("senderId", Arrays.asList(userIds)); query.whereContainedIn("recipientId", Arrays.asList(userIds)); query.orderByAscending("createdAt"); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> messageList, com.parse.ParseException e) { if (e == null) { for (int i = 0; i < messageList.size(); i++) { WritableMessage message = new WritableMessage(messageList.get(i).get("recipientId").toString(), messageList.get(i).get("messageText").toString()); if (messageList.get(i).get("senderId").toString().equals(currentUserId)) { messageAdapter.addMessage(message, MessageAdapter.DIRECTION_OUTGOING); } else { messageAdapter.addMessage(message, MessageAdapter.DIRECTION_INCOMING); } } } } }); }
@Override public void onMessageSent(MessageClient client, Message message, String recipientId) { final WritableMessage writableMessage = new WritableMessage(message.getRecipientIds().get(0), message.getTextBody()); //only add message to parse database if it doesn't already exist there ParseQuery<ParseObject> query = ParseQuery.getQuery("ParseMessage"); query.whereEqualTo("sinchId", message.getMessageId()); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> messageList, com.parse.ParseException e) { if (e == null) { if (messageList.size() == 0) { ParseObject parseMessage = new ParseObject("ParseMessage"); parseMessage.put("senderId", currentUserId); parseMessage.put("recipientId", writableMessage.getRecipientIds().get(0)); parseMessage.put("messageText", writableMessage.getTextBody()); parseMessage.put("sinchId", writableMessage.getMessageId()); parseMessage.saveInBackground(); messageAdapter.addMessage(writableMessage, MessageAdapter.DIRECTION_OUTGOING); } } } }); }
public static void getLeaderBoard(Context context, String category, int rpa, FindCallback<LeaderBoard> callback){ try { if(Util.isConnected(context)) { ParseQuery.getQuery(LeaderBoard.class) .whereEqualTo("modalidade", category) .whereEqualTo("rpa", rpa) .findInBackground(callback); } else { ParseQuery.getQuery(LeaderBoard.class) .fromLocalDatastore() .whereEqualTo("modalidade", category) .whereEqualTo("rpa", rpa) .findInBackground(callback); } } catch (Exception e){ e.printStackTrace(); } }
public static void getPlayoff(Context context, String category, int rpa, int key, FindCallback<Playoff> callback){ try { if(Util.isConnected(context)) { ParseQuery.getQuery(Playoff.class) .whereEqualTo("modalidade", category) .whereEqualTo("rpa", rpa) .whereEqualTo("chave", key) .findInBackground(callback); } else { ParseQuery.getQuery(Playoff.class) .fromLocalDatastore() .whereEqualTo("modalidade", category) .whereEqualTo("rpa", rpa) .whereEqualTo("chave", key) .findInBackground(callback); } } catch (Exception e){ e.printStackTrace(); } }
public static void getMatches(Context context, String category, int rpa, DateTime date, FindCallback<Match> callback){ try { if(Util.isConnected(context)) { ParseQuery.getQuery(Match.class) .whereEqualTo("modalidade", category) .whereEqualTo("rpa", rpa) .whereEqualTo("data", date.toString("dd/MM/YY")) .orderByAscending("group") .findInBackground(callback); } else { ParseQuery.getQuery(Match.class) .fromLocalDatastore() .whereEqualTo("modalidade", category) .whereEqualTo("rpa", rpa) .whereEqualTo("data", date.toString("dd/MM/YY")) .orderByAscending("group") .findInBackground(callback); } } catch (Exception e){ e.printStackTrace(); } }
public static void getTeamPlayers(Context context, String teamName, String category, int rpa, FindCallback<Player> callback){ try { if(Util.isConnected(context)) { ParseQuery.getQuery(Player.class) .whereEqualTo("NOME_EQUIPE", teamName) .whereEqualTo("MODALIDADE_EQUIPE", category) .whereEqualTo("RPA_EQUIPE", rpa) .orderByAscending("NOME_JOGADOR") .findInBackground(callback); } else { ParseQuery.getQuery(Player.class) .fromLocalDatastore() .whereEqualTo("NOME_EQUIPE", teamName) .whereEqualTo("MODALIDADE_EQUIPE", category) .whereEqualTo("RPA_EQUIPE", rpa) .orderByAscending("NOME_JOGADOR") .findInBackground(callback); } } catch (Exception e){ e.printStackTrace(); } }
/** * Fetches the list of snack entries for a user using a specified mode. If the mode is not * recognized, the mode defaults to EXPORT_EVERYTHING. * * @param user Which user's entries to fetch. * @param mode The mode to use when fetching (EXPORT_LAST_24_HOURS, EXPORT_LAST_48_HOURS, * EXPORT_EVERYTHING). * @param callback The callback to invoke upon completion. */ private static void getSnacks(ParseUser user, int mode, FindCallback<SnackEntry> callback){ // Milliseconds in a day. final long millis24Hours = 1000 * 60 * 60 * 24; ParseQuery<SnackEntry> query = new ParseQuery<>(SnackEntry.class); query.whereEqualTo("owner", user); switch(mode){ case EXPORT_LAST_24_HOURS: query.whereGreaterThanOrEqualTo("createdAt", new Date(System.currentTimeMillis() - millis24Hours)); break; case EXPORT_LAST_48_HOURS: query.whereGreaterThanOrEqualTo("createdAt", new Date(System.currentTimeMillis() - millis24Hours * 2)); break; // case EXPORT_EVERYTHING: no constraint on createdAt. // default: no constraint on createdAt (export everything) } query.findInBackground(callback); }
public void updateName(final String name, final String id) { Log.d("UserAPI", "start updateName"); ParseQuery<ParseUser> query = ParseUser.getQuery(); query.whereEqualTo(USERNAME, ParseUser.getCurrentUser().getUsername()); query.findInBackground(new FindCallback<ParseUser>() { public void done(List<ParseUser> objects, ParseException e) { if (e == null) { for (ParseUser parseUser : objects) { Log.d("UserAPI", "find object"); if (parseUser.getObjectId().equals(id)) { Log.d("UserAPI", "found, rename"); ParseUser.getCurrentUser().put(USERNAME, name); } } } else { Log.d("UserAPI", "problem in updateName"); e.printStackTrace(); } } }); }
public void updateEmail(final String email, final String id) { Log.d("UserAPI", "start updateEmail"); ParseQuery<ParseUser> queryOne = ParseUser.getQuery(); queryOne.whereEqualTo(EMAIL, email); queryOne.findInBackground(new FindCallback<ParseUser>() { public void done(List<ParseUser> objects, ParseException e) { if (e == null) { for (ParseUser parseUser : objects) { if (parseUser.getObjectId().equals(id)) { ParseUser.getCurrentUser().put(EMAIL, email); } } } else { Log.d("UserAPI", "problem in updateEmail"); e.printStackTrace(); } } }); }
private void check() { ParseQuery<ParseObject> query = ParseQuery.getQuery("Exsmple"); query.whereEqualTo("name", etNick.getText().toString()); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> scoreList, ParseException e) { if (e == null) { if (scoreList.size() > 0) { handler.sendEmptyMessage(0); } else { Toast.makeText(Login.this, "Hellow illegal", Toast.LENGTH_SHORT).show(); } Log.d(AppConstants.MY_TAG, "Retrieved " + scoreList.size() + " " + scoreList.toString() + " scores"); } else { Log.d(AppConstants.MY_TAG, "Error: " + e.getMessage()); } } }); }
public static List<Attraction> getAttractionListFromParse(){ final List<Attraction> attractionList = new ArrayList<Attraction>(); ParseQuery<ParseObject> query = ParseQuery.getQuery("Attraction"); // execute the query query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> attList, ParseException e) { // Log.d("data", String.valueOf(followList.size())); for(ParseObject object : attList) { attractionList.add(new Attraction( object.getString("Name"), object.getString("Description"), object.getString("longDescription"), Uri.parse(object.getString("imageUrl")), Uri.parse(object.getString("secondaryImageUrl")), new LatLng(object.getParseGeoPoint("location").getLatitude(),object.getParseGeoPoint("location").getLongitude()), object.getString("city") )); } } }); return attractionList; }
public void updateAllTrainersWithCertificationInfo() { ParseQuery<Trainer> query = ParseQuery.getQuery("Trainer"); query.findInBackground(new FindCallback<Trainer>() { public void done(List<Trainer> objects, ParseException e) { if (e == null) { for (Trainer trainer : objects) { trainer.setEducationAndCertifications(getCertifcationsAndEducation()); trainer.setInterestsAndAchievements(getInterestsAndAchievements()); trainer.saveInBackground(); Log.d("DEBUG", "Found " + objects.size() + " trainer objects"); } } else { Log.d("DEBUG", "Find all trainer objects query FAILED"); } } }); }
private void addNewMessages() { String[] objectIds = {m_me.objectId, m_other.objectId}; ParseQuery<Message> query = ParseQuery.getQuery("Message"); query.whereContainedIn("fromObjectId", Arrays.asList(objectIds)); query.whereContainedIn("toObjectId", Arrays.asList(objectIds)); query.orderByAscending("createdAt"); query.findInBackground(new FindCallback<Message>() { public void done(List<Message> messages, ParseException e) { if (e == null) { // Set the value of global current user object for (int i = 0; i < messages.size(); i++) { Message message = messages.get(i); if (!m_messages.contains(message)) { messagesAdapter.add(message); lvMessages.setSelection(lvMessages.getCount() - 1); } } } else { Log.d("DEBUG", "Error: " + e.getMessage()); } } }); }
public void alreadyBookedSlots(final String trainerId, final String sDay, final String sDate, final Context context) { arBookedSlots.clear(); ParseObject trainer = ParseObject.createWithoutData("Trainer", trainerId); ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots"); query.selectKeys(Arrays.asList("slot_time")); query.include("trainer_id"); query.whereEqualTo("trainer_id", trainer); query.whereEqualTo("slot_date", sDate); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> bookedSlots, com.parse.ParseException e) { if (e == null) { for (ParseObject slots : bookedSlots) { int slotTime = Integer.valueOf(slots.getString("slot_time")); arBookedSlots.add(slotTime); } } else { Log.d("DEBUG", "Error: " + e.getMessage()); } populateAvailableSlots(trainerId, sDay, sDate, context); } }); }