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 6871097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:45:49+00:00 2026-05-27T03:45:49+00:00

I’m using AsyncTask to display a progressBar while loading Rss News. Because this is

  • 0

I’m using AsyncTask to display a progressBar while loading Rss News. Because this is my first time i m using asyncTask i dont know if my method is right,so could you please tell me if it looks good to you?Its working but i want just to be sute!Thanks

public class BackgroundAsyncTask_nea extends
       AsyncTask<Void, Void, Void> {
          private ProgressDialog dialog;
        int myProgress;

        @Override
        protected void onPostExecute(Void result) {
            // TODO Auto-generated method stub
            displayRss();
             dialog.dismiss();


        }

        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub
              dialog = ProgressDialog.show(nea.this, "", "Loading. Please wait...", true);
            myProgress = 0;
        }

        @Override
         protected void onProgressUpdate(Void... values) {
          // TODO Auto-generated method stub
          //super.onProgressUpdate(values);
         }

        @Override
        protected Void doInBackground(Void... arg0) {
            // TODO Auto-generated method stub
            loadFeed();
            return null;
        }



    }

loadFeed();

private void loadFeed(){
        try{ 
            BaseFeedParser parser = new BaseFeedParser();
            messages = parser.parse();

            }
        catch (Throwable t){
            Log.e("OSFP.News",t.getMessage(),t);


            finish();
        }
    }

displayRss();

private void displayRss(){

        ArrayList<HashMap<String, String>> List_nea = new ArrayList<HashMap<String, String>>(messages.size());


        for (Message msg : messages){

            des.add(msg.getDescription());// keimeno
            text.add(msg.getTitle());// titlos
            url.add(msg.getLink());// link
            imgl.add(msg.getImgLink());

        HashMap<String, String> map = new HashMap<String, String>();
        map.put("name", msg.getTitle());
        map.put("date", msg.getDate());     


        List_nea.add(map);
        ListAdapter mSchedule = new SimpleAdapter(this, List_nea, R.layout.row,
                new String[] {"name", "date"}, new int[] {R.id.TextView01, R.id.TextView02});
        this.setListAdapter(mSchedule);
        }

    AnimationSet set = new AnimationSet(true);

    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(400);
    set.addAnimation(animation);

    animation = new TranslateAnimation(
        Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF, 0.0f,
        Animation.RELATIVE_TO_SELF, -1.0f,Animation.RELATIVE_TO_SELF, 0.0f
    );

    animation.setDuration(400);
    set.addAnimation(animation);
    LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f);
    ListView listViewn = getListView();        
    listViewn.setLayoutAnimation(controller);

    }
  • 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-05-27T03:45:50+00:00Added an answer on May 27, 2026 at 3:45 am

    In order to update the progress bar you need to be making calls to the publishProgress() function. You’re not doing that anywhere in your code. If I were you I’d pass a reference of the AsyncTask down into your loadFeed function. Something like this:

        protected Void doInBackground(Void... arg0) {
            // TODO Auto-generated method stub
            loadFeed(this);
            return null;
        }
    
    private void loadFeed(AsyncTask<Void, Void, Void> asyncTask){
            // make calls to publishProgress in here.
               try{ 
                BaseFeedParser parser = new BaseFeedParser();
                messages = parser.parse();
    
                }
            catch (Throwable t){
                Log.e("OSFP.News",t.getMessage(),t);
    
    
                finish();
            }
        }
    

    You’ll also need to implement the onProgressUpdate() method which you have not. This is where you’ll actually update the value of your progress bar.

         protected void onProgressUpdate(Integer... progress) {
             dialog.setProgress(progress[0]);
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
Does anyone know how can I replace this 2 symbol below from the string
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

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.