简体   繁体   English

从userList android获取解析对象

[英]get parse object from userList android

I am little bit confused to resolve this error. 我有点困惑要解决此错误。 I want to search email Id from Parse and check it either this email Id already exists there or not, if it exists there then it will give toast message to the user otherwise it will be create the account and it's data will be save on Parse. 我想从Parse中搜索电子邮件ID,并检查该电子邮件ID是否已经存在,如果存在,那么它将向用户发送Toast消息,否则将创建该帐户并将其数据保存在Parse中。 But, I am getting an error my data is not searching from Parse and not showing my desire result. 但是,我遇到一个错误,我的数据不是从Parse搜索,也没有显示我想要的结果。

ParseQuery<ParseObject> query = ParseQuery.getQuery("AppUser");
                            query.whereEqualTo("email", emailstr);
                            query.findInBackground(new FindCallback<ParseObject>() {
                                @Override
                                public void done(List<ParseObject> userList, com.parse.ParseException e) {
                                    if (e == null) {
                                        if (userList.size() == 0) {

                                            saveUserOnParse(user);
                                        }else{

                                            Toast temp = Toast.makeText(Sign_up.this, "This email is already exist here, You must enter another email for SIGN UP.", Toast.LENGTH_SHORT);
                                            temp.show();
                                        }


                                } else {
                                    }
                                }



                            });

I want to search email if current email is not existing in the userList then save user on parse. 如果userList中不存在当前电子邮件,我想搜索电子邮件,然后在解析时保存用户。 Please anybody help me, how can I do it. 请任何人帮助我,我该怎么做。

Thank you, I have done solve my problem by using this code. 谢谢,我已经通过使用此代码解决了我的问题。

ParseQuery<ParseObject> query = ParseQuery.getQuery("FileName");
                            query.whereEqualTo("email", user.getEmail());
                            query.countInBackground(new CountCallback() {
                                @Override
                                public void done(int count, com.parse.ParseException e) {
                                    if (e == null){
                                        if (count == 0){
                                            saveUserOnParse(user);
                                        }
                                        else{
                                            Toast temp = Toast.makeText(Sign_up.this, "This email is already exist here, You must enter another email for SIGN UP.", Toast.LENGTH_SHORT);
                                            temp.show();
                                        }
                                    }
                                    else{
                                        Toast temp = Toast.makeText(Sign_up.this, e+ "Exception", Toast.LENGTH_SHORT);
                                        temp.show();
                                    }
                                }


                            });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM