本文整理汇总了Java中com.parse.ParseQuery.getFirstInBackground方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.getFirstInBackground方法的具体用法?Java ParseQuery.getFirstInBackground怎么用?Java ParseQuery.getFirstInBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.getFirstInBackground方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retreiveprofile
import com.parse.ParseQuery; //导入方法依赖的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
}
}
});
}
示例2: retreivetimelineprofile
import com.parse.ParseQuery; //导入方法依赖的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
}
}
});
}
示例3: addCommentTask
import com.parse.ParseQuery; //导入方法依赖的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();
}
});
}
示例4: addCommentTask
import com.parse.ParseQuery; //导入方法依赖的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();
}
});
}
示例5: setUsersImageToParse
import com.parse.ParseQuery; //导入方法依赖的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();
}
}
});
}
示例6: delete
import com.parse.ParseQuery; //导入方法依赖的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();
}
}
});
}
示例7: read
import com.parse.ParseQuery; //导入方法依赖的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();
// }
}
}
});
}
示例8: getCurrentUserId
import com.parse.ParseQuery; //导入方法依赖的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());
}
}
});
}
示例9: populateFavoriteTrainers
import com.parse.ParseQuery; //导入方法依赖的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);
}
}
示例10: asyncGetUserInfo
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void asyncGetUserInfo(final String username,final EMValueCallBack<EaseUser> callback){
ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
pQuery.whereEqualTo(CONFIG_USERNAME, username);
pQuery.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject pUser, ParseException e) {
if(pUser!=null){
String nick = pUser.getString(CONFIG_NICK);
ParseFile pFile = pUser.getParseFile(CONFIG_AVATAR);
if(callback!=null){
EaseUser user = DemoHelper.getInstance().getContactList().get(username);
if(user!=null){
user.setNick(nick);
if (pFile != null && pFile.getUrl() != null) {
user.setAvatar(pFile.getUrl());
}
}else{
user = new EaseUser(username);
user.setNick(nick);
if (pFile != null && pFile.getUrl() != null) {
user.setAvatar(pFile.getUrl());
}
}
callback.onSuccess(user);
}
}else{
if(callback!=null){
callback.onError(e.getCode(), e.getMessage());
}
}
}
});
}
示例11: onCreateView
import com.parse.ParseQuery; //导入方法依赖的package包/类
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Profile activity = (Profile) getActivity();
String selected_user = activity.sendmydata();
View view = inflater.inflate(R.layout.activity_timeline, container, false);
timeline_user_email = (TextView) view.findViewById(R.id.tv_usermail);
timeline_question_count = (TextView) view.findViewById(R.id.question_count);
timeline_designation = (TextView) view.findViewById(R.id.tv_timeline_desig);
timeline_usernmae = (TextView) view.findViewById(R.id.set_user_orignalname);
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("username", selected_user);
query.getFirstInBackground(new GetCallback<ParseUser>() {
@Override
public void done(ParseUser parseUser, ParseException e) {
if (e == null) {
user_name = parseUser.getString("Name");
user_desig = parseUser.getString("who");
user_email = parseUser.getEmail();
user_question_count = parseUser.get("query_count").toString();
timeline_usernmae.setText(user_name);
timeline_designation.setText(user_desig);
timeline_user_email.setText(user_email);
timeline_question_count.setText(user_question_count);
} else {
}
}
});
return view;
}
示例12: checkID
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void checkID(final String idNumber)
{
//lookup logic here
ParseQuery<ParseObject> query = ParseQuery.getQuery(mGradeTableName);
query.whereEqualTo("id_number",idNumber);
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
if(e == null)
{
mListener.onStudentFound(mCourse,parseObject,mLabCount);
}
else
{
if(e.getCode() == ParseException.OBJECT_NOT_FOUND)
{
Log.d("Student not found",idNumber+" not found in "+mGradeTableName+" table");
Toast.makeText(getActivity(),"Student "+idNumber+" Not found",Toast.LENGTH_LONG).show();
}
else
{
//Some other error
Log.d("Parse error","Code:"+e.getCode());
Toast.makeText(getActivity(),"Internal error",Toast.LENGTH_LONG).show();
}
}
}
});
}
示例13: isBullshITBankBtnTask
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void isBullshITBankBtnTask(){
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!");
List<String> BullshITCountList = parseObject.getList("bullshitcount");
if(BullshITCountList==null){
BullshITCountList = new ArrayList<String>();
Log.d("TAG","BullshITCountList is null");
}
if(BullshITCountList.contains(GUID)){
BullshITBtnBg.setBackgroundColor(Color.parseColor("#ffffb600"));
BullshITCountList.remove(GUID);
Log.d("TAG","BullshITCount Minus");
}else{
BullshITBtnBg.setBackgroundColor(Color.RED);
BullshITCountList.add(GUID);
Log.d("TAG","BullshITCount Plus");
}
parseObject.put("bullshitcount",BullshITCountList);
parseObject.saveInBackground();
BullshITCount.setText(String.valueOf(BullshITCountList.size()));
}
});
}
示例14: initiateChannels
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void initiateChannels() {
//create new channels to parse only if the user is new
//get the object id now and save it for future use
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("email", Profiles.getInstance().loginEmail);
//check if email already existed in database
query.getFirstInBackground(new GetCallback<ParseUser>() {
public void done(ParseUser object, ParseException e) {
if (object == null) {
//get the object id now and save it for future uses
setMyChannelObjectId(object.getObjectId());
object.put("channels", "");
object.saveInBackground();
} else {
//already exists
//get the object id now and save it for future uses
setMyChannelObjectId(object.getObjectId());
//set the subscribed channels list locally
String channelList = object.getString("channels");
MyChannels subscriptionList = MyChannels.getInstance();
subscriptionList.initiateLocalChannelsList(channelList);
Log.d("score", "subscription list updated");
}
}
});
}
示例15: sync
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void sync(Table table) {
Log.i("Slice", "" + NetworkStatus.isConnected);
Log.i("Slice", "Slice synchronized start");
for (final Slice slice : table.getList()) {
if (slice.getId() == null) {
create(slice);
} else {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Slice");
if (!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", slice.getId());
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parseSlice, ParseException e) {
if (parseSlice == null) {
Log.i("Slice", "Sync: The getFirst request failed.");
} else {
if (!slice.getUpdatedat().equals(parseSlice.getUpdatedAt()))// ----------
try {
update(slice);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Log.i("Slice", "Sync: update dont need");
}
}
});
}
}
}