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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:53:39+00:00 2026-05-23T08:53:39+00:00

My project that I’ve spent almost 40hrs on is almost complete, but I have

  • 0

My project that I’ve spent almost 40hrs on is almost complete, but I have one last task to accomplish. My previous problem what that when users clicked to pull up a news RSS feed that app would sometimes hang because it both tried to load the activity and the feed at the same time. This was resolved with asynctask.

Now along with this, I have four buttons that switch between different feeds and essentially just modifying the view. This eliminates reloading the screen or new activity. Well, when I initially fire up this activity, the asynctask works exactly like I want, but it’s not as simple as copying pasting to each of the different views at the bottom. How do I implement asynctask under each of those different buttons/views. You’ll see the onClick at the bottom.

Here is the asynctask section.

public class RssLoadingTask extends AsyncTask<Void, Void, Void> {

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

         @Override
         protected void onPreExecute() {
          // TODO Auto-generated method stub
          preReadRss();
         }

         @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
          readRss();
          return null;
         }

        }

And below here is the onClick section. Obviously with the above i have each readRss, preReadRSS, etc…in the right places in the initial activity, but why won’t Java allow me to place these same asynctask tasks in the onClick section? I just don’t know enought about modifiers yet to know how to place them. Still learning a lot.

public void onClick(View v) {

if (v == hawknation) {


    try {

          URL rssUrl = new URL("http://www.rss.com/feed");
          SAXParserFactory mySAXParserFactory = SAXParserFactory.newInstance();
          SAXParser mySAXParser = mySAXParserFactory.newSAXParser();
          XMLReader myXMLReader = mySAXParser.getXMLReader();
          RSSHandler myRSSHandler = new RSSHandler();
          myXMLReader.setContentHandler(myRSSHandler);
          InputSource myInputSource = new InputSource(rssUrl.openStream());
          myXMLReader.parse(myInputSource);

          myRssFeed = myRSSHandler.getFeed();

         } catch (MalformedURLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
         } catch (ParserConfigurationException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
         } catch (SAXException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
         } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
         }}


   {

         if (myRssFeed!=null)
         {
          TextView feedTitle = (TextView)findViewById(R.id.feedtitle);
          TextView feedDescribtion = (TextView)findViewById(R.id.feeddescribtion);
          TextView feedPubdate = (TextView)findViewById(R.id.feedpubDate);
          TextView feedLink = (TextView)findViewById(R.id.feedlink);
          feedTitle.setText(myRssFeed.getTitle());
          feedDescribtion.setText(myRssFeed.getDescription());
          feedPubdate.setText(myRssFeed.getPubdate());
          feedLink.setText(myRssFeed.getLink());

          MyCustomAdapter adapter =
           new MyCustomAdapter(this, R.layout.row, myRssFeed.getList());
          setListAdapter(adapter);

         }       
     }
  • 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-23T08:53:39+00:00Added an answer on May 23, 2026 at 8:53 am

    I ended up not using my view in question. I just switch between views by opening a different activity on each button.

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

Sidebar

Related Questions

I currently have one project that currently contains multiple packages. These packages make up
I have a large project that executes without problem when not debugging (even when
I have an asp project that works fine with CodeFile, but when I change
I have a MVC project that uses foo.dll, but that foo.dll uses smu.dll so
I have an iOS project that sends a Person class with one attribute name
I have an Android project that is targeted to Android 15, but has a
I have a project that I'm currently working on but it currently only supports
I have a project that may be started on local machine with ./manage.py runserver
I have a project that I have divided quite aggressively into different layers. I
I have a Silverlight project that uses MVVM with Prism. I followed http://www.telerik.com/help/silverlight/patterns-and-practices-eventtocommand-prism.html I

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.