简体   繁体   中英

Parse Android - How to Query ObjectId From another class to _User class

I'm having trouble trying to write this query. I want to be able to store the pointer array into my _User class but grab the information from my Car class. In my car class there is a pair of object Id.

[{"__type":"Pointer","className":"Car","objectId":"OBJECTID"},


{"__type":"Pointer","className":"Car","objectId":"OBJECTID"}]

    final ArrayList<String> CarId = new ArrayList<String>();
    ParseQuery query = new ParseQuery("Car");
    query.include("objectId");
    query.findInBackground(new FindCallback<ParseUser>() {

        @Override
        public void done(List<ParseUser> list, ParseException e) {
            if (e == null) {
                Log.d("CarId", "Retrieved " + list.size() + " CarId");
                for (int i = 0; i < list.size(); i++) {
                    CarId.add(list.get(i).getString("objectId"));
                    ParseObject po1 = list.get(i);
                    String po2 = po1.getObjectId()

                }
            } else {
                Log.d("score", "Error: " + e.getMessage());
            }
        }
    });
}

Make your variable public static . And then you can access that variable inside your another class.

In another class you can fetch that variable as _User.CarId;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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