January 2014
Intermediate to advanced
736 pages
70h 43m
English
Figure 5.18 shows the MainActivity package statement, import statements and fields. Lines 6–21 import the various Java and Android classes and interfaces that the app uses. We’ve highlighted the new import statements, and we discuss the corresponding classes and interfaces in Section 5.3 and as they’re encountered in Sections 5.5.2––5.5.6.
Lines 26–27 define constants for the preference keys you created in Section 5.4.10. You’ll use these to access the corresponding preference values. The boolean variable phoneDevice (line 29) specifies whether the app is running on a phone—if so, the app will allow only portrait orientation. The boolean variable preferencesChanged (line 30) specifies whether ...
Read now
Unlock full access