User Tools

Site Tools


android_learning:headfirst_android_development_notes:chapter_4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
android_learning:headfirst_android_development_notes:chapter_4 [2016/01/17 23:25] mithatandroid_learning:headfirst_android_development_notes:chapter_4 [2016/02/14 23:08] (current) – [p. 147: Code blocks] mithat
Line 1: Line 1:
-<WRAP center round info 60%> 
-Under development. 
-</WRAP> 
- 
 ====== Chapter 4 notes ====== ====== Chapter 4 notes ======
  
Line 52: Line 48:
 </code> </code>
  
-===== p. 122 =====+===== p. 122: Code blocks =====
  
 Extra code to add to ''StopWatchActivity.java'' (i.e., don't replace the entire file). Extra code to add to ''StopWatchActivity.java'' (i.e., don't replace the entire file).
Line 99: Line 95:
 </code> </code>
  
-===== p. 127 =====+===== p. 127: Code blocks =====
 To ''StopwatchActivity.java'' add the following to the end of ''onCreate()'' To ''StopwatchActivity.java'' add the following to the end of ''onCreate()''
 <code java> <code java>
Line 133: Line 129:
 To rotate a stock AVD, use the ''Ctrl+F11'' shortcut to switch to the previous layout orientation and ''Ctrl+F12'' to switch to next layout orientation. To rotate a stock AVD, use the ''Ctrl+F11'' shortcut to switch to the previous layout orientation and ''Ctrl+F12'' to switch to next layout orientation.
  
-===== pp. 137-138: Code locks =====+===== pp. 137-138: Code blocks =====
  
 ''onSaveInstanceState'' method to be added to ''StopwatchActivity'': ''onSaveInstanceState'' method to be added to ''StopwatchActivity'':
Line 183: Line 179:
     }     }
 } }
-<code>+</code> 
 + 
 +===== p. 149: Expected app behavior ===== 
 +{{youtube>eJI5Hv7hiR0??600x360&rel=0}} 
 +\\ 
 + 
 +===== pp. 152-153 ===== 
 +You may want to skip these pages until you have completed the app through p. 158. 
 + 
 +===== pp. 154-158 ===== 
 +Note that in the final version of this app, methods ''onStart'' and ''onStop'' are no longer needed. This is because ''onResume'' will be called after ''onStart'' and ''onPause'' will normally be called before ''onStop''
 + 
 +Coming up with a test case on an AVD that will partially obscure your app and put it into "Pause" is not trivial. However, if you start and restart the app, it should behave the same as before (even though you have now placed the run/don't run code in ''onResume'' and ''onPause''
 + 
 +Don't stress out if you aren't able to test that the changed code works when the app is "Paused" (i.e., not having focus), but do be sure it still works when "Stopped" and "Restarted". And be sure to understand what Android is doing and the pause/resume process. (P.S., don't forget to read pp. 152-153.) 
 + 
 +===== p. 162 ===== 
 +The diagram is a good one to copy and tape next to your computer. 
android_learning/headfirst_android_development_notes/chapter_4.1453073142.txt.gz · Last modified: 2016/01/17 23:25 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki