Rss Reader Android App Tutorial 4: Drag to Refresh in ListView Android Example

New Update: Adding Loading More in FooterView
Several weeks ago, I created a IOS tutorial about how to implement pull to refresh in IOS UITableView. In my Rss reader android app, I also want to add pull to refresh feature so that user can easily update the ListView content. I searched online and spend several to integrate one open source project in my Android ListView example. After that, I find it is quite hard to make some change basing on the open source project because of its poor flexibility. Therefore, I decide to create my own drag to refresh ListView (or called pull to refresh ListView).

In my app, I will create a subclass of ListView which is called RefreshableListView. The new ListView class will allow user to drag down and trigger loading event. So my RefreshableListView will implement the interface OnScrollListener and override the interface functions onScroll and onScrollStateChanged; To track user interactions, I will override the function onTouchEvent as well. Once we drag down the ListView, we will see the headerView which gives a tip “Pull Down to Update”. If we release ListView, the headerView will stay on the top and wait for updating. Once the updating processing finishes, the headerView will shrink back and disappear. Now let’s see the example source code step by step.
Read more

Rss Reader Android App Tutorial 3: Parse XML in Android

In the previous tutorial about Rss Reader Android app, I gave the example code about how to get the data from website using AsyncTask. After we get the data, we have to read it and convert the format to server our app. XML is the standard data format for RSS. In this android example, I will show you how to parse XML in Android. If you are first time to read this post, I think you also are interested in reading the these two examples:

Read more

Adding Admob Banner in Android ListView Header

Adding AdMob ads banner in ListView header is quite difficult, comparing with adding ads banner in IOS UITableView header. It is simply because there is no header section for ListView in Android. But IOS UITableView has and UITableViewDelegate offers a very convenient way to customize the header and footer. For Android ListView, we have two ways to solve the problem. In this Android AdMob example, I will show you how to add AdMob Banners in Android ListView App.

Read more

Download Images by AsyncTask in ListView Android Example

Loading images is the most common task for Android apps. Loading image task can be very simple. But if the image size is very big or there are lots of images to be downloaded, it will take a long time. During the downloading progress, all android UI will freeze. Therefore, we have to download images in different thread from main thread (UI thread). In this Android tutorial, I will give an example to show how to use Asynctask to download a list of images.

Download and Try Download Images In AsyncTask Android Example
chart

Read more