本文整理匯總了Java中com.parse.GetCallback類的典型用法代碼示例。如果您正苦於以下問題:Java GetCallback類的具體用法?Java GetCallback怎麽用?Java GetCallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GetCallback類屬於com.parse包,在下文中一共展示了GetCallback類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getEventData
import com.parse.GetCallback; //導入依賴的package包/類
public void getEventData(final ICardCallback<ILobbyEventCard> callback) {
ParseQuery<LobbyEventCard> query = ParseQuery.getQuery(LobbyEventCard.class);
query.getInBackground(Constans.PARSE_EVENT_OBJECT_ID, new GetCallback<LobbyEventCard>() {
@Override
public void done(LobbyEventCard object, ParseException e) {
if (e == null) {
callback.onSuccess(false, object);
} else {
callback.onError(e);
}
}
});
}
示例2: retreiveprofile
import com.parse.GetCallback; //導入依賴的package包/類
public static void retreiveprofile(String username , final Context context) {
ParseQuery<ParseObject> query= ParseQuery.getQuery("Profile");
query.whereEqualTo("user",username);
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
if(parseObject!=null && e==null) {
ParseFile file = (ParseFile) parseObject.get("image");
String url = "http://wwww.webianks.com";
if (file != null) {
url = file.getUrl().toString();
}
MainActivity.retriveProfileCallback(context, url);
}else{
//canntretrivee file
}
}
});
}
示例3: retreivetimelineprofile
import com.parse.GetCallback; //導入依賴的package包/類
public static void retreivetimelineprofile(String username , final Context context) {
ParseQuery<ParseObject> query= ParseQuery.getQuery("Profile");
query.whereEqualTo("user",username);
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
if(parseObject!=null && e==null) {
ParseFile file = (ParseFile) parseObject.get("image");
String url = "http://wwww.webianks.com";
if (file != null) {
url = file.getUrl().toString();
}
Profile.retriveTimelineProfileCallback(context, url);
}else{
//canntretrivee file
}
}
});
}
示例4: addCommentTask
import com.parse.GetCallback; //導入依賴的package包/類
public void addCommentTask(){
ParseQuery<ParseObject> query = ParseQuery.getQuery("BullshITBankDB");
query.whereEqualTo("phone", Phone);
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
Log.d("TAG","Done Loading Detail!");
String NewComment = AddComment.getText().toString();
List<String> CommentsList = parseObject.getList("comments");
if(CommentsList==null){
CommentsList = new ArrayList<String>();
}
CommentsList.add(NewComment+"["+GUID+"]");
parseObject.put("comments",CommentsList);
parseObject.saveInBackground();
loadDetail();
}
});
}
示例5: addCommentTask
import com.parse.GetCallback; //導入依賴的package包/類
public void addCommentTask(String Number, final String Comment, final String GUID){
ParseQuery<ParseObject> query = ParseQuery.getQuery("BullshITBankDB");
query.whereEqualTo("phone", Number);
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
Log.d("TAG", "Done Loading Detail!");
List<String> CommentsList = parseObject.getList("comments");
if(CommentsList==null){
CommentsList = new ArrayList<String>();
}
CommentsList.add(Comment+"["+GUID+"]");
parseObject.put("comments",CommentsList);
parseObject.saveInBackground();
}
});
}
示例6: initData
import com.parse.GetCallback; //導入依賴的package包/類
private void initData() {
String id = getArguments().getString(USER_ID);
mState = getArguments().getString(Constants.CATEGORY);
if (id != null && mState != null) {
QueryHelper.getUserById(id, new GetCallback<User>() {
@Override
public void done(User user, ParseException e) {
if (e == null) {
mUser = user;
mUserQueryAdapter = new UserQueryAdapter(getActivity(), null, mState, mUser);
setListAdapter(mUserQueryAdapter);
} else {
NotificationHelper.alert(getActivity(),
getString(R.string.dialog_error_title),
e.getMessage());
}
}
});
}
}
示例7: onResume
import com.parse.GetCallback; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onResume() {
super.onResume();
mPivBigAvatar.setParseFile(mUser.getAvatar());
if (mUser.getAvatar() != null) {
mPivBigAvatar.loadInBackground();
} else {
mPivBigAvatar.setBackground(getResources().getDrawable(R.drawable.ic_avatar));
}
if (mMyRoom != null) {
mMyRoom.fetchIfNeededInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject room, ParseException e) {
if (e == null) {
mRiMyRoom.setData(LocalDb.getInstance().getCurrentUser(), mMyRoom);
}
}
});
}
setRoomUIElementsVisibility();
}
示例8: setData
import com.parse.GetCallback; //導入依賴的package包/類
public void setData(User user) {
mSelectedUser = user;
mSelectedUser.fetchIfNeededInBackground(new GetCallback<ParseObject>() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void done(ParseObject parseObject, ParseException e) {
mTvUsername.setText(mSelectedUser.getUsername());
mPivAvatar.setParseFile(mSelectedUser.getAvatar());
if (mSelectedUser.getAvatar() != null) {
mPivAvatar.loadInBackground();
} else {
mPivAvatar.setBackground(getResources().getDrawable(R.drawable.ic_avatar));
}
if (!mCurrentUser.equals(mSelectedUser)) {
mFbFollow.setData(mCurrentUser, mSelectedUser);
}
}
});
}
示例9: setUsersImageToParse
import com.parse.GetCallback; //導入依賴的package包/類
public void setUsersImageToParse(String username, final File image){
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("username", username);
query.getFirstInBackground(new GetCallback<ParseUser>() {
public void done(ParseUser UsersClass, ParseException e) {
if (UsersClass == null) {
Log.d("score", "no success setUsersImageToParse");
} else {
//success
UsersClass.put("ProfilePic", image);
UsersClass.saveInBackground();
pullParseAndSetOtherUsersDatainBackground();
}
}
});
}
示例10: delete
import com.parse.GetCallback; //導入依賴的package包/類
public void delete(final String id) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Slice");
if (!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", "" + id);
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parseSlice, ParseException e) {
if (parseSlice == null) {
Log.i("Slice", "Deleted: The getFirst request failed.");
} else {
Log.i("Slice", "Slice " + id + " is deleted");
parseSlice.put("deleted", true);
parseSlice.pinInBackground();
parseSlice.saveInBackground();
}
}
});
}
示例11: read
import com.parse.GetCallback; //導入依賴的package包/類
public void read(String UUID, ParseObject parseLine, final List<Slice> sliceList) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Point");
if (!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", UUID);
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parsePoint, ParseException e) {
if (parsePoint == null) {
Log.i("Point", "Read: The getFirst request failed.");
} else {
// try {
Log.i("Point", "Starting read");
// parsePoint.fetch();
Point point = new Point(parsePoint.getDouble("x"), parsePoint.getDouble("y"));
point.setObjectId(parsePoint.getString("UUID"));
onresult.onResult(point, sliceList);
// } catch (ParseException e1) {
// Log.d("Point", "Read: object not nul, but" + e1);
// e1.printStackTrace();
// }
}
}
});
}
示例12: getCurrentUserId
import com.parse.GetCallback; //導入依賴的package包/類
private void getCurrentUserId(String phoneNumber) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("SimpleUser");
query.whereEqualTo("phone_number", phoneNumber);
query.getFirstInBackground(new GetCallback<ParseObject>(){
public void done(ParseObject object, ParseException e) {
if (e == null) {
String userId = object.getObjectId().toString();
String currentUserObjId = userId;
SimpleUser.currentUserObjectId = currentUserObjId;
// Write the userId in shared pref if the user successfully signed up
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor edit = pref.edit();
edit.putString("userId", userId);
edit.commit();
Intent returnIntent = new Intent();
setResult(RESULT_OK, returnIntent);
finish();
overridePendingTransition(R.anim.stay_in_place, R.anim.exit_to_bottom);
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
}
});
}
示例13: populateFavoriteTrainers
import com.parse.GetCallback; //導入依賴的package包/類
public void populateFavoriteTrainers() {
showProgressWheel();
final TrainersListFragment finalFragment = fragment;
String currentUserId = getLoggedInUserId();
// If userId is found; user has already signed up
if (!currentUserId.equals("")) {
ParseQuery<SimpleUser> query = ParseQuery.getQuery("SimpleUser");
query.whereEqualTo("objectId", currentUserId);
query.getFirstInBackground(new GetCallback<SimpleUser>() {
@Override
public void done(SimpleUser simpleUser, ParseException e) {
SimpleUser.currentUserObject = simpleUser;
showFavorites();
}
});
} else {
// Ask the user to sign up
launchLoginActivity(LOGIN_FOR_FAVORITES);
}
}
示例14: insertStockImage
import com.parse.GetCallback; //導入依賴的package包/類
void insertStockImage(String imageId, ImageView ivImage) {
ivImage.setBackgroundColor(R.color.gray7);
ParseQuery<StockImage> query = ParseQuery.getQuery(StockImage.class);
final ImageView ivImageRef = ivImage;
final String iid = imageId;
Log.d("DEBUG", "Fetching StockImage " + imageId + " for ImageView " + ivImageRef);
query.getInBackground
(imageId,
new GetCallback<StockImage>() {
public void done(StockImage sImage, ParseException e) {
if (e == null) {
Log.d("DEBUG", "Callback for StockImage " + sImage.getObjectId() +
" (expected " + iid + ") and ImageView " + ivImageRef);
if (ivImageRef.getTag().equals(sImage.getObjectId())) {
setImageFile(sImage, ivImageRef);
} else {
Log.d("DEBUG", "stale callback for " + sImage.getObjectId() + "; "
+ "Image " +ivImageRef + " is now " + ivImageRef.getTag());
}
} else {
Log.d("ERROR", "erp! " + e);
}
}
});
}
示例15: getOrFetchUser
import com.parse.GetCallback; //導入依賴的package包/類
public static void getOrFetchUser(final long userId, final Async.Block<User> completion) {
if (User.getUser(userId) != null) {
if (completion != null) {
completion.call(User.getUser(userId));
}
} else {
getUser(userId, new GetCallback<User>() {
@Override
public void done(User user, ParseException e) {
user.putInCache();
if (completion != null) {
completion.call(e == null ? user : null);
}
}
});
}
}