Search code examples
javaviewrssfeed

Android Studio RSS Reader.


I'm currently working on attempting to make an RSS Reader using a ListView in Android studio. I've already managed to make the ListView, but i have no idea where to go next. I cant seem to find any good tutorials online on how i should tackle this, and Anything i do find is out of date by 3 years. Any tips?

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.micha.rssreader.MainActivity">

<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:id="@+id/listviewAD" />

MainActivity.java

package com.example.micha.rssreader;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends AppCompatActivity {
public ListView AdFeed; // maakt listview aan
public String[] items;
public ArrayAdapter<String> adapt;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    AdFeed = (ListView)findViewById(R.id.listviewAD); 
    items = new String[]{"blue", "red", "black", "orange", "purpol"};
    adapt = new ArrayAdapter<String>(this, R.layout.items, items);
    AdFeed.setAdapter(adapt);//zet de data acther de listview
    AdFeed.setOnItemClickListener(new AdapterView.OnItemClickListener() { 
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

        }
    });

  }
} 

Solution

  • Try this example

    http://www.androidauthority.com/simple-rss-reader-full-tutorial-733245/

    it is up to date since it uses buildToolsVersion 25.0.1. Only difference is that it uses RecyclerView instead of ListView, which is recommended since it is lighter than ListView