A Custom List with Images - Introduction

Android Custom Lists: 1 2 3 4 5 6 7 8

In this section, you're going to create an app that looks like this:

An Android List app with images

It's only got five items in the list, but it's easy to add more, once you learn how. Tapping an item in the list will launch a new screen that leads to a bigger image of the flag you selected. At the end of this section, you should be able to adapt the app to suit your own needs.

There's going to be quite a lot of files in this project, and it is a bit complex. First, let's list the Java code files we'll be creating

MainActivity
BigImage
RowItem
CustomAdapter

The first two on the list are Activities that the user will see, so they'll both have XML files attached to them. The final two are separate Java files, with no associated XML files.

We'll also need a few XML files. We'll be creating these:

activity_main
activity_big_image
list_view_row
list_colours
gradient

The first two XML files on the list above are the ones that will be associated with the Java files. The third one will be a single row in the ListView. The final two are for later, when we show you how to add colours and gradien

For this section, it would help if you had a basic knowledge of how to create classes. There a tutorial here on our site, if you're a bit rusty: http://www.homeandlearn.co.uk/java/write_your_own_java_classes.html. But don't be put off, if your class writing skills are none-existent.

 

Let's make a start, then.