Home How to put ParseQuery in seperate class and call this method in every activity in android?
Reply: 0

How to put ParseQuery in seperate class and call this method in every activity in android?

user1157
1#
user1157 Published in May 26, 2018, 9:35 pm

i'm new to android and coding in general

i have many textviews in my app so i'm retrieving string from parse and displaying it in textview.

i'm using the following parse query

 ParseQuery<ParseObject> query=ParseQuery.getQuery("Topics");
    query.getInBackground("fRGt3oz8af", new GetCallback<ParseObject>(){
        public void done(ParseObject arg0, ParseException arg1) {

            if (arg1==null)
            {
                    subTopicName = arg0.getString("class_1");
                    textView.setText("" + subTopicName);

            }

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

}});

since i've many textview i have to repeat the same code for retrieve each string. so i'm trying to avoid code redundancy.

my question is how can i put the above query in different java class and call that method for retrieving each strings? or is there different method way to do it. I've never worked on parse server before so I'm really struggling with this.

Any help would be appreciated.

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO