1

enter image description here

I am working on parse.com android application in which I want to get data from UserInfo table, Getting data from _User table is quite easy through .GetCurrentUser but I can't get data from UserInfo table like ObjectId etc columns. Some code snippet of mine is given below in which I want to get the data from UserInfo table. Attached snapshot is also given below for better understanding of a table.

 ParseQuery<ParseObject> query = ParseQuery.getQuery("UserInfo");
            // query.whereEqualTo("userName",user_name);
           query.findInBackground(new FindCallback<ParseObject>() {
               @Override
               public void done(List<ParseObject> categoryAttributes, ParseException e) {
                    if (e == null) {
                     for (int i = 0; i < categoryAttributes.size(); i++){

                     }
                       }
                    else {
                           Log.d("score", "Error: " + e.getMessage());
                          // Alert.alertOneBtn(getActivity(),"Something went wrong!");
                       }   
               }
           });
1
  • Are you not getting data in "categoryAttributes" ParseObject? Commented Dec 27, 2014 at 10:31

1 Answer 1

1

I make use of the query.find() but you would hove to create an AsyncTask. The way to do it with the query.findInBackground() would be the next:

//String id = "AnyID";
ParseQuery<ParseObject> query = ParseQuery.getQuery("UserInfo");
        // query.whereEqualTo("objectId", id);
        query.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> categoryAttributes, ParseException e) {
                if (e == null) {
                    for (ParseObject ob: categoryAttributes){
                        Log.d("DATA", "ObjectID: " + ob.getObjectId());
                        Log.d("DATA", "Column1: " + ob.getString("NameColumn"));
                        Log.d("DATA", "Column2: " + ob.getString("NameColumn"));
                        Log.d("DATA", "Column3: " + ob.getString("NameColumn"));
                    }
                }
                else {
                    Log.d("DATA", "Error: " + e.getMessage());
                    // Alert.alertOneBtn(getActivity(),"Something went wrong!");
                }
            }
        });

I couldn't she the name of the other tables but this would be the way to get the data out of a table of parse.Also you con see commented a way to look in a table for an object by its id.

String id = "AnyID";
ParseQuery<ParseObject> query = ParseQuery.getQuery("UserInfo");
         query.whereEqualTo("objectId", id);

Hope it was what you were looking for.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.