Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9090635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:25:11+00:00 2026-06-16T22:25:11+00:00

I have a class which downloads information from a website. I’m using the AsyncTask

  • 0

I have a class which downloads information from a website.
I’m using the AsyncTask at the moment to get it, so the ui will stay responsive.

I understand how to update the GUI using the publishProgress and onProgessUpdate, but what if I have a big method (or function) within a different class?

It is easier to show with the code:

@Override
protected ArrayList<Card> doInBackground(Void... voids)
{
    Looper.prepare();
    publishProgress("Creating object");
    SomeClass someClass = new SomeClass();
    publishProgress("Performing a long operation");
    ArrayList<Card> = someClass.getCards();//This method takes a long while. I would like to call the "publishProgress" method from the "someClass".

    return athopGetter.getCards();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:25:12+00:00Added an answer on June 16, 2026 at 10:25 pm

    You can pass the task reference to ‘someClass’, since publishProgress is protected final, you need to implement your own publish method, which simply invoke publishProgress,

    task = new AsyncTask<...>() {
       ...
       public void myPublish(Progress... values) {
           publishProgress(values);
       } 
    };
    

    or you can use reflection to invoke publishProgress directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my app, I have a class that inherits from AsyncTask and which downloads
I have a progress bar managed by a AsyncTask which downloads some files from
I have written the code which downloads the file from FTP server. Since I
I have an application (Xcode 4.5) which downloads images from Flicker. I have a
I have asynctask which downloads an mp3 and I have a custom expanded notification
I have an Activity which downloads the data from the Database. While the Activity
I have an app which downloads images from a server, stores them on the
I have an application that downloads information from a web service and caches it
I have an application (Xcode 4.5) which downloads images from Flicker. I have a
I have class which have one public method Start , one private method and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.