O'Reilly logo

Android Programming: The Big Nerd Ranch Guide by Brian Hardy, Bill Phillips

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

Displaying a List of Runs Using CursorAdapter

To set the ground work for a user interface listing the runs, create a new default activity for the app called RunListActivity and set it as the default in the manifest. Ignore the error about RunListFragment for the moment.

Listing 34.11  The great and powerful RunListActivity (RunListActivity.java)

p​u​b​l​i​c​ ​c​l​a​s​s​ ​R​u​n​L​i​s​t​A​c​t​i​v​i​t​y​ ​e​x​t​e​n​d​s​ ​S​i​n​g​l​e​F​r​a​g​m​e​n​t​A​c​t​i​v​i​t​y​ ​{​

 ​ ​ ​ ​@​O​v​e​r​r​i​d​e​
 ​ ​ ​ ​p​r​o​t​e​c​t​e​d​ ​F​r​a​g​m​e​n​t​ ​c​r​e​a​t​e​F​r​a​g​m​e​n​t​(​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​r​e​t​u​r​n​ ​n​e​w​ ​R​u​n​L​i​s​t​F​r​a​g​m​e​n​t​(​)​;​
 ​ ​ ​ ​}​

}​

Listing 34.12  Configuring RunListActivity (AndroidManifest.xml)

<​a​p​p​l​i​c​a​t​i​o​n​ ...

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