8 Creating User Interfaces with Layouts and Widgets

In this chapter, you will learn more about layouts and widgets while adding a crime’s date and status to CriminalIntent.

Upgrading Crime

Open Crime.java and add two new fields. The Date field represents the date a crime occurred. The boolean field represents whether the crime has been solved.

Listing 8.1  Adding more fields to Crime (Crime.java)

p​u​b​l​i​c​ ​c​l​a​s​s​ ​C​r​i​m​e​ ​{​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​U​U​I​D​ ​m​I​d​;​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​S​t​r​i​n​g​ ​m​T​i​t​l​e​;​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​D​a​t​e​ ​m​D​a​t​e​;​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​b​o​o​l​e​a​n​ ​m​S​o​l​v​e​d​;​ ​ ​ ​ ​p​u​b​l​i​c​ ​C​r​i​m​e​(​)​ ​{​ ​ ​ ​ ​ ​ ​ ​ ​m​I​d​ ​=​ ​U​U​I​D​.​r​a​n​d​o​m​U​U​I​D​(​)​;​ ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.