本文整理汇总了Java中com.parse.ParseQuery.findInBackground方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.findInBackground方法的具体用法?Java ParseQuery.findInBackground怎么用?Java ParseQuery.findInBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.findInBackground方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: localQuery
import com.parse.ParseQuery; //导入方法依赖的package包/类
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();
}
}
});
}
示例2: localQuery
import com.parse.ParseQuery; //导入方法依赖的package包/类
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();
}
}
});
}
示例3: serverQuery
import com.parse.ParseQuery; //导入方法依赖的package包/类
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");
}
}
});
}
示例4: getContactInfos
import com.parse.ParseQuery; //导入方法依赖的package包/类
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());
}
}
});
}
示例5: loadParseData
import com.parse.ParseQuery; //导入方法依赖的package包/类
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());
}
}
});
}
示例6: loadParseData
import com.parse.ParseQuery; //导入方法依赖的package包/类
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());
}
}
});
}
示例7: verifyOrganization
import com.parse.ParseQuery; //导入方法依赖的package包/类
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();
}
}
});
}
示例8: loadData
import com.parse.ParseQuery; //导入方法依赖的package包/类
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();
}
});
}
});
}
示例9: getSnacks
import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
* 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);
}
示例10: refresh
import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
* Refreshes the DietitianList. That is, queries Parse for all ParseUsers whose isDietitian field is true and
* repopulates the DietitianList with the result. If the query fails, the DietitianList remains
* unchanged.
*
* @param callback Optional. The callback to invoke after completion.
*/
public void refresh(@Nullable final FindCallback<ParseUser> callback){
Log.d(TAG, "Refresh start");
notifyUpdateStart();
ParseQuery<ParseUser> query = ParseQuery.getQuery("_User");
query.whereEqualTo("isDietitian", true);
query.findInBackground(new FindCallback<ParseUser>() {
@Override
public void done(List<ParseUser> refreshedDietitians, ParseException e) {
if (e == null) {
dietitians.clear();
dietitians.addAll(refreshedDietitians);
}
if (callback != null) {
callback.done(refreshedDietitians, e);
}
notifyUpdateComplete();
}
});
}
示例11: getMatches
import com.parse.ParseQuery; //导入方法依赖的package包/类
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);
}
}
}
});
}
示例12: addNewMessages
import com.parse.ParseQuery; //导入方法依赖的package包/类
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());
}
}
});
}
示例13: getSelectedChannel
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void getSelectedChannel() {
ParseQuery<ParseObject> query = ParseQuery.getQuery(Constants.PARSE_CLASS_CHANNEL);
query.fromLocalDatastore();
query.findInBackground(new FindCallback<ParseObject>() {
@Override public void done(List<ParseObject> list, ParseException e) {
if (e == null) {
Log.e(LOG_TAG, "Channels retrieved from localDataStore - list size: " + list.size());
} else {
Log.e(LOG_TAG, "Error on retrieving Channels from localDataStore");
}
if (list.size() == 0) {
retrieveChannels();
} else {
mSelectedChannel = (Channel) list.get(0);
Log.e(LOG_TAG, "Found channel selected: " + mSelectedChannel.toString());
}
}
});
}
示例14: onCreate
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_trainer_details);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setNavigationBarColor(getResources().getColor(R.color.navigationBarColor));
}
setupToolbar();
// Get the trainer object from parse and setup the view
trainerId = getIntent().getStringExtra("trainerId");
ParseQuery<Trainer> query = ParseQuery.getQuery("Trainer");
query.whereEqualTo("objectId", trainerId);
query.include("favorited_by");
query.findInBackground(new FindCallback<Trainer>() {
@Override
public void done(List<Trainer> list, com.parse.ParseException e) {
Log.d("DEBUG", ((Trainer) list.get(0)).getName());
m_trainer = list.get(0);
// Get the gym where the trainer goes to workout
getTrainerGym();
}
});
}
示例15: refresh
import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
* Refreshes the ClientList. That is, queries Parse for the current user's ParseUsers (clients) and
* repopulates the ClientList with the result. If the query fails, the ClientList remains
* unchanged.
*
* @param callback Optional. The callback to invoke after completion.
*/
public void refresh(@Nullable final FindCallback<ParseUser> callback){
Log.d(TAG, "Refresh start");
notifyUpdateStart();
ParseQuery<ParseUser> query = ParseQuery.getQuery("_User");
query.whereEqualTo("myDietitian", ParseUser.getCurrentUser());
query.findInBackground(new FindCallback<ParseUser>() {
@Override
public void done(List<ParseUser> refreshedClients, ParseException e) {
if (e == null) {
clients.clear();
clients.addAll(refreshedClients);
}
if (callback != null) {
callback.done(refreshedClients, e);
}
notifyUpdateComplete();
}
});
}