A (175)

(Tuis.) #1

200 CHAPTER 6: Android Screen Design: Writing to the Display Using Activity and View


Figure 6-30. Collapse the createDefaultGalaxy( ) method to make room in the IDE; add seven TextView declarations


We will create all of the TextView object(s) instantiation code inside of a createUiTextViews( )
method so that all our onCreate( ) method will contain is method calls to Java routines or structures
that create the Galaxy and TextView objects, and later on a call to wire them all together using a
transferDataValues( ) Java code structure.


A UI Instantiation Method: createUiTextViews( )


Now it’s time to create the second method that will be called in the onCreate( ) method. Let’s add a
new-line in the onCreate( ) method after the createDefaultGalaxy( ) method call and type in a
createTextViews( ) method call. As you can see in Figure 6 -3 1 , this is error highlighted; on mouse-over,
Eclipse offers to write the code for you!

Free download pdf