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

  • SEARCH
  • Home
  • 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 7974947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:31:16+00:00 2026-06-04T08:31:16+00:00

I’m implementing an Android app to load RSS feed. It works perfectly fine until

  • 0

I’m implementing an Android app to load RSS feed. It works perfectly fine until I decided to add a new screen for displaying two buttons and trying to pass a String value to the AsyncTask. The idea is this: The screen will display two buttons for the users to choose. Once the user has clicked on one of the buttons, it will invoke the AsyncTask along with the string value(url) to readRSS(url), then the rss feed is displayed by displayRSS(url). The readRSS(url) will load the RSS feed accordingly.

My codes are as below:

import java.util.List;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

public class RSSProActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.rss);
        startLoadRSS();

    }

    private void startLoadRSS(){
        new RSS_Load().execute();
    }

    //
    private void preReadRSS()
    {
        Toast.makeText(this, "Reading RSS, Please wait.", Toast.LENGTH_LONG).show();
    }

        private StringBuffer readRSS(String url)
        {
            //depends on the inputs, will set the String value accordingly. It should be "url" but using the default value at the moment.

            String urlStr = "http://www.bom.gov.au/fwo/IDZ00059.warnings_vic.xml";
            AndroidSAXFeedParser saxFeedParser = new AndroidSAXFeedParser(urlStr);
            List<RSSItem> parse = saxFeedParser.parse();
            StringBuffer sb = new StringBuffer();
            sb.append(parse.size()+" items found");
            for(RSSItem item:parse){
                sb.append(item.getTitle()+"posted at "+item.getDate());
                sb.append(item.getDescription());
            }
            return sb;
        }

        private void displayRSS()
        {
            StringBuffer sb = readRSS(url);
            TextView textView = new TextView(this);
            textView.setText(sb.toString());
            setContentView(textView);
            Toast.makeText(this, "SUCCESS", Toast.LENGTH_LONG).show();
        }


        //AsyncTask
        public class RSS_Load extends AsyncTask<Void, Void, Void>{
           @Override
           protected void onPreExecute() {
              super.onPreExecute();
              preReadRSS();
           }

           @Override
           protected Void doInBackground(Void... arg0) {
             readRSS();
                       // should be readRSS(url) here
               return null;
           }

           @Override
           protected void onProgressUpdate(Void... values) {
              //super.onProgressUpdate(values);
          //    updateProgressBar(values[0]);

           }

           @Override
           protected void onPostExecute(Void result) {
              super.onPostExecute(result);
           //   dismissProgressBar();
                // should be displayRSS(url) here
            displayRSS();

           }               

 }
}

I’m trying to change the value in RSS_Load extends AsyncTask but it gives me compile error. So I changed the protected Void doInBackground(String… url) then passing the url to readRSS(url) but it doesn’t work either. How should I achieve this?

Thanks in advance!

  • 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-04T08:31:17+00:00Added an answer on June 4, 2026 at 8:31 am

    The … means that it’s actually passing an array of that type. So if you change it to:

    protected Void doInBackground(String... arg0)
    

    You would need to do this:

    @Override
    protected Void doInBackground(String... arg0)
    {
        readRSS(arg0[0]);
        // should be readRSS(url) here
        return null;
    }
    
    • 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,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.