O'Reilly logo

Android Programming for Beginners by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The database mini app

In this section, we will put into practice everything that you have learned so far and create a mini database that enables us to add, delete, search, and select data.

First, let's create a new project with all the settings at their default values and call it Database. The code for this mini app is in the download bundle of the Chapter 23/Database folder.

Implementing the layout

Create the layout by copying and pasting the next block of XML code. There is nothing new or complicated in the code, but be sure to review it to make a mental note of the various id properties on the EditText and Button widgets because it will make understanding the Java code simpler.

Add this XML to the layout_main.xml file:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required