Android Open Source - RSSNewsReaderApp Retrieve Feed Task






From Project

Back to project page RSSNewsReaderApp.

License

The source code is released under:

GNU General Public License

If you think the Android project RSSNewsReaderApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.romanostrechlis.rssnews.auxiliary;
/*  ww w.ja va 2s .  com*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

import android.os.AsyncTask;

/**
 * RetrieveFeedTask implements the asynchronous functionality between application and servers.
 * 
 * <p>RetrieveFeedTask extends {@link AsyncTask}.
 * 
 * @author Romanos Trechlis 
 */
class RetrieveFeedTask extends AsyncTask<String, Void, String> {

    protected String doInBackground(String... urls) {
        try {
            URL url= new URL(urls[0]);
            URLConnection urlCon = url.openConnection();
          BufferedReader br = new BufferedReader(new InputStreamReader(urlCon.getInputStream()));
          StringBuilder sbResponse = new StringBuilder();

      String sLine;
      while((sLine = br.readLine()) != null) {
              sbResponse.append(sLine);
          }
          String result = sbResponse.toString();
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}




Java Source Code List

com.romanostrechlis.rssnews.DetailActivity.java
com.romanostrechlis.rssnews.MainActivity.java
com.romanostrechlis.rssnews.auxiliary.DatabaseHandler.java
com.romanostrechlis.rssnews.auxiliary.ExpCustomListAdapter.java
com.romanostrechlis.rssnews.auxiliary.Helper.java
com.romanostrechlis.rssnews.auxiliary.ManageCustomArrayAdapter.java
com.romanostrechlis.rssnews.auxiliary.OnSwipeTouchListener.java
com.romanostrechlis.rssnews.auxiliary.RetrieveFeedTask.java
com.romanostrechlis.rssnews.auxiliary.UpdateService.java
com.romanostrechlis.rssnews.content.RssFeed.java
com.romanostrechlis.rssnews.content.RssItem.java
com.romanostrechlis.rssnews.legacy.MainCustomArrayAdapter.java
com.romanostrechlis.rssnews.legacy.NodeDetailActivity.java
com.romanostrechlis.rssnews.legacy.NodeDetailFragment.java
com.romanostrechlis.rssnews.legacy.NodeListActivity.java
com.romanostrechlis.rssnews.legacy.NodeListFragment.java
com.romanostrechlis.rssnews.managefeeds.EditRssFeedActivity.java
com.romanostrechlis.rssnews.managefeeds.ManageActivity.java
com.romanostrechlis.rssnews.managefeeds.NewFeedsActivity.java
com.romanostrechlis.rssnews.settings.SettingsActivity.java