How to create news feed in Android Studio

The RSS stands for Rich Site Summary. It is used to read the latest update made on the content of a blog or website. RSS feed is mostly used for reading the summary of a blog (newsletter). The content for RSS feed is provided in XML format.

The XML format for RSS reader contains the following tags.

In this tutorial, we will read the content of the website (Rediff.com and Cinemablend.com) using Android RSS Feed reader. The contents are displayed in ListView of Android and clicking on these items will load their respective URL.

Android RSS Feed Reader Example

Create an activity MainActivity.java with the following code. Clicking on the button of this activity redirect to RSSFeedActivity.java class and load the content of a given URL.

activity_main.xml


MainActivity.java


Create a layout rss_item_list_row.xml which contains the fields of a newsletter (page URL, title, publishing date) which are displayed in RSS Feed.

rss_item_list_row.xml


RSSItem.java


Create RSSParser.java class, in this class; we will use the instance of DocumentBuilderFactory class to parse the XML document.

RSSParser.java


Now, create an activity RSSFeedActivity.java with the following code. This class uses AsyncTask class to load the items of RSS Feed from the URL in the background.

activity_rssfeed.xml


RSSFeedActivity.java


Create an activity WebActivity.java containing WebView, that load the content of the link clicked in the previous activity.

activity_web.xml


WebActivity.java


Permission Required

Add the INTERNET permission in AndroidMenifest.xml file.

Output:

How to create news feed in Android Studio
How to create news feed in Android Studio
How to create news feed in Android Studio

I'll give you an option, and the first step. You can use requests via JSON to search the texts and images stored on a web served.

// DownloadJSON AsyncTask
    private class DownloadJSON extends AsyncTask<Void, Void, Void> {

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            // Create a progressdialog
            mProgressDialog = new ProgressDialog(MainActivity.this);
            // Set progressdialog title
            mProgressDialog.setTitle("Your app");
            // Set progressdialog message
            mProgressDialog.setMessage("Loading...");
            mProgressDialog.setIndeterminate(false);
            // Show progressdialog
            mProgressDialog.show();

        }

        @Override
        protected Void doInBackground(Void... params) {


            // Create an array
            arraylist = new ArrayList<HashMap<String, String>>();
            // Retrieve JSON Objects from the given URL address
            jsonobject = JSONfunctions
                    .getJSONfromURL("YOUR_PATH_URL_CONECT.PHP");

            try {



                // Locate the array name in JSON
                jsonarray = jsonobject.getJSONArray("value");


                for (int i = 0; i < jsonarray.length(); i++) {
                    HashMap<String, String> map = new HashMap<String, String>();
                    jsonobject = jsonarray.getJSONObject(i);
                    // Retrive JSON Objects
                    map.put("thumbImage", jsonobject.getString("thumbImage"));
                    map.put("title", jsonobject.getString("title"));


                    // Set the JSON Objects into the array
                    arraylist.add(map);
                }
            } catch (JSONException e) {
                Log.e("Error", e.getMessage());
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void args) {
            // Locate the listview in listview_main.xml
            listview = (ListView) findViewById(R.id.listview);
            // Pass the results into ListViewAdapter.java
            adapter = new ListViewAdapter(MainActivity.this, arraylist);
            // Set the adapter to the ListView
            listview.setAdapter(adapter);
            // Close the progressdialog
            mProgressDialog.dismiss();


                return;

        }
    }

YOUR_PATH_URL_CONECT.PHP

echo '{"value":'.json_encode($yourArrayJsonObject).'}';

Now do the rest of creating adapters.

How to create news feed in Android Studio

Project: News Feed Reader In Android

-To download news feed reader project for free(Scroll Down)

This is a simple news reader application for Android. Here the user can select the categories from which they can read the news feeds. To run the project you will need Android Studio. So before you run the project make sure that you have Android Studio on your computer.

About the project

The project deals with the user who wants to read news from the mobile application. It helps them with that. Here he/she can select the categories of news they are looking to read. When you are done selecting the categories, then you can simply refresh the page to get news on your mobile application. Also, you can either export or import the news to your local storage media. This application is fully responsive and has a good-looking user interface. The users will find this application much interesting for reading the news articles.

In order to run the project, first, install Android Studio. Then import the project from the studio’s homepage. Your project set up will automatically start. All the Gradle build files will automatically install inside your project root directory. Run the project and set up your virtual device and run the emulator. The project will start and you will see the home screen with a dialog box asking you to select the categories.

Be Alert

This whole project is developed in Android studio. Here java programming language is used for the field validation and also XML language for the transferring of data. This project keeps asking you about the plugins update so keep your internet alive. And moreover, you will need to update your SDK version and also you have to update your instant run plugins.

Project Demo:

https://youtu.be/6y1P8DQpZQY

DOWNLOAD NEWS FEED READER IN ANDROID WITH SOURCE CODE FOR FREE: CLICK THE BUTTON BELOW


Post navigation

How do I create a news feed app on Android?

Here is what the application will look like in the end:.
Step 1: Create a New Project..
Step 2: Add dependencies..
Step 3: Add permissions..
Step 4: Get an API Key..
Step 5: Create a new empty activity and add a WebView to the layout..
Step 6: Working with the WebActivity.java file..

How do I create an activity feed?

Create an Activity Feed post.
Navigate to a course homepage with the Activity Feed widget available..
Click anywhere in the Create a post text box..
Enter a message..
Optionally, add an attachment by doing one of the following:.
Click Post..

How do I create a news Channel app?

How To Create a News App In 3 Easy Steps.
Enter the News App Builder. Before using the news app builder, your need to sign in to our platform. ... .
Set Up Your News Mobile App. Add the features, branding colors, and design with a few simple clicks, all code-free..
Publish Your News Mobile App On Online Market..

How do I customize my news feed?

Open Google News and tap on the Following option on the left hand menu to pull up a list of topics and publications you're following. Next to the interest you want to unfollow, click More > Remove from library. To like or unlike a story or hide stories from a source: Under a story you like or don't like, tap More.