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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:18:51+00:00 2026-05-27T22:18:51+00:00

In My Application i am parsing the feed from the net as like below

  • 0

In My Application i am parsing the feed from the net as like below code:

private void downloadEpisodes(String Url) {
    //Make Progress Bar Visible While Downloading Feed
    progress_bar.setVisibility(ProgressBar.VISIBLE);
    Log.d("CGRParser", "Downloading Feed");
    //Start an ASync Thread to take care of Downloading Feed
    new DownloadEpisodes().execute(Url);
}

private class DownloadEpisodes extends AsyncTask<String, Integer, ArrayList<LatestNews>> {
    ArrayList<LatestNews> episodes;
    @Override
    protected ArrayList<LatestNews> doInBackground(String... url) {

        //Download and Parse Feed
        XmlFeedParser parser = new XmlFeedParser();
        episodes = new ArrayList<LatestNews>();
        episodes = parser.parse(url[0]);
        return episodes;
    }

    @Override
    protected void onPostExecute(ArrayList<LatestNews> result) {
        //Feed has been Downloaded and Parsed, Display Data to User
        Log.d("CGRParser", "Feed Download Complete");
        displayEpisodes(result);
    }
}

private void displayEpisodes(ArrayList<LatestNews> news_detail) {
    //Create String Arrays to seperate titles and dates
    Log.d("CGRParser", "Displaying News Titles To User");
    ArrayList<String> episode_titles = new ArrayList<String>();
    ArrayList<String> episode_description = new ArrayList<String>();
    ArrayList<String> episode_link = new ArrayList<String>();
    for (LatestNews news : news_detail) {
        Log.d("News", "News Title: " + news.getTitle());
        Log.d("News", "News Description: " + news.getDescription());
        Log.d("News", "News Link: " + news.getLink());
        episode_titles.add(news.getTitle());
        episode_description.add(news.getDescription());
        episode_link.add(news.getLink());
    }

    this.episode_titles = episode_titles;
    this.episode_description = episode_description;
    this.episode_link = episode_link;

    //Create a ListAdapter to Display the Titles in the ListView
    ListAdapter adapter = new ArrayAdapter<String>(this, R.layout.latest_news_row, R.id.title, episode_titles);
    listview_news.setAdapter(adapter);
    //Set Progress Bar Invisible since we are done with it
    progress_bar.setVisibility(ProgressBar.INVISIBLE);

}

Now with this code i want to handle the internet availability. If internate is not available then the Message should be dispaly like “Please check the internate connection.”

Please help me for this.
Thanks.

  • 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-27T22:18:52+00:00Added an answer on May 27, 2026 at 10:18 pm

    You have to put network state permission in your manifest.

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    

    Then you can check if the connection is available with a function like this one (someone posted it eralier in stackoverflow and I use it in my app):

        public boolean isOnline() {
        ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo netInfo = cm.getActiveNetworkInfo();
        if (netInfo != null && netInfo.isConnectedOrConnecting()) {
            return true;
        }
        return false;
    }
    

    And then you simply check if isOnline in your activity and show a Toast or other dialog if it’s not. And I think you should do the check in your activity before task.execute(), not in the AsyncTask.

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

Sidebar

Related Questions

I've built an iPhone application using the parsing code from the TopSongs sample iPhone
I have the following XML Parsing code in my application: public static XElement Parse(string
I have an ASP.NET application that I need to show a video feed from
Here is the code for my simple parsing application. I am getting an error
I have developed an application that fetches the feed from a sever, displays the
I want to parse an rss feed from an android application. Everything related to
In my application while parsing the XML I have a string in the foundcharacters
I'm creating a parsing application, which parses ~20 sites, ~7-15 values from each. Pseudocode
We have an application parsing date/time values in the following format: 2009-10-10 09:19:12.124 2009-10-10
I am doing mail parsing application which required to convert the HTML file to

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.