Android Development: creating and android listview app
4th Sep 2021 | category: Apps | Hits: 259In android development, using a listview is one of the mostly used formats of data presentation in an app. In this tutorial, we are going to focus on how to create an app with a listview presentation format. Some of the most commonly used apps use this format of data presentation, these include whatsapp, this is evident when displaying contacts and chat threads, Viber, Skype, Twitter when displaying tweets, and even the phonebook uses a listview to display contacts stored in a phone.
Note: The demo app was created using IntelliJ IDEA 13.1.6 development environment but is also compatible with Android Studio and Eclipse development environments. This tutorial assumes that you have a java coding background as most of the work is going to be done in java programming language. And the results displayed in the xml layout file.
In this tutorial we are going to create and app which will show the user a list of Google’s apps and services.
- Create a new project using IntelliJ IDEA and call it Listview.
- Create a new resource file in the layout directory called list_item.xml, this file holds the structure of the listview.
- Open the newly created file and insert the code below
Create a new layout inside the res - > layout directory and call it single_list_item_view.xml , this file will display a single selected item from the listview of items.
Open the newly created file and insert the code below
- Go to the values directory and create a new resource file called list_data.xml, this file will hold all the data that we want to put in our list.
- Open the newly created file and insert the code below.
- Now that all our data display/ view/layout files are created
- Open the MyActivity.java file and insert the code below