ParseQuery to retrieve string by objectId in Parse Dataase

datacrusader Source

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());
            }

}});
javaandroidparse.comtextview

Answers

answered 6 months ago Jav T #1

You can get the objectId via

myParseObject.getObjectId()

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

comments powered by Disqus