Home ParseQuery to retrieve string by objectId in Parse Dataase
Reply: 1

ParseQuery to retrieve string by objectId in Parse Dataase

datacrusader
1#
datacrusader Published in 2018-02-14 06:26:26Z

I have created a class "Topics" in parse database and i'm able to retrieve it to textview.

i have more than one textView so i don't want to repeat the same code.

How to retrieve a string for example if it's objectID is "fdjk"
for example i want it to work this way

if(objectId == fdjk){
 String subTopicName = arg0.getString("class_1");
 textView.setText("" + subTopicName);
}
 else if(objectId == fdjkk){
 String subTopicName1 = arg0.getString("class_1");
 textView1.setText("" + subTopicName1);
}

The following code works single object

    ParseQuery<ParseObject> query=ParseQuery.getQuery("Topics");
    query.getInBackground("fRGt3oz8af", new GetCallback<ParseObject>(){

    @Override
        public void done(ParseObject arg0, ParseException arg1) {

            if (arg1==null)
            {

                    subTopicName = arg0.getString("class_1");
                    textView.setText("" + subTopicName);
                    progressDialog.dismiss();
                }

            else
            {
                Log.d("topic", "Error: " + arg1.getMessage());
            }

}});
Jav T
2#
Jav T Reply to 2018-02-14 07:10:27Z

You can get the objectId via

myParseObject.getObjectId()

Or maybe you should to a findInBackground so you can hace the full list of objects

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308634 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO