1 / 18

Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources

Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters 1-6. Navigating in Android Studio alt-1 is project view (alt-F1 is show it in project view)

mervyn
Télécharger la présentation

Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters 1-6

  2. Navigating in Android Studio alt-1 is project view (alt-F1 is show it in project view) alt-2 is favorites (including bookmarks and breakpoints) alt-3 is the search view (cntl-shift-F to find) alt-4 run-console alt-5 is debug alt-6 is android view (ddms, logcat) alt-7 is structure view (see members and methods) alt-9 is changes(VCS) view Look at the margin of your project

  3. Get help • cntl-shift-A (find anything in Android studio) Searching (on mac, replace cntrl with command) cntl-F (find something in the local file) cntl-shift-F (find something in the project) Go to file in code (on mac, replace cntrl with command) cntl-N (go to files typically in src) cntl-shift-n (go to any file, including res) cntl-E (open recent files) Go to file in project alt-F1

  4. Go to definition cntl-B (go directly to the method definition) Javadocs cntl-Q (open the javadocs) Live Templates cntl-J adding your own Live Templates (cntl-shift-A “live template”)

  5. Debugging Using the debugger (alt-5) See bookmarks and breakpoints (alt-2) F11 to toggle bookmark Using logcat (alt-6) Using lint and AS analyzer: Analyze || Inspect Code ///TODO this is my todo message

  6. Resources in Android

  7. Layouts and resources Code: Java (or C if you use NDK) Metafiles: AndroidManifest, project.properties, .gitignore. These all describe the project. Resources “anything in android that is not code or metafiles” Activities have one or more layouts, and all Layouts have a root-ViewGroup. This root-ViewGroup is the container for the Views. R.java (gen directory) is a bridge between your resources and your code. If you want to interact programmatically with a resource, it must have an id.

  8. Inspecting layouts and resources You can view both xml and design mode in AS. You can see how it would look on multiple devices || preview all screens, and toggle with remove previews.

  9. Layouts and resources res directories can have suffixes, such as layout-land, or drawable-hdpi, values-es, etc. These suffixes allow you to differentiate at RUNTIME depending on the settings, hardware, and configuration of the device. For example, if your device is in landscape mode, it'll try to fetch the layout from layout-land first, then it will try to fetch the layout from layout. Vice versa as well; if it's in portait mode, it'll try for layout-port, then layout. shown in preview mode of resource and rotate device

  10. Lifecycle in Android

  11. video: geoQuizz03.webm start 12:30 slides: from bc03 If you (config change) or the OS must bounce your activity, it'll crawl the root-ViewGroup and place the data about the activity into the bundle. In labGeoQuiz bc03 we are putting the mCurrentIndex in the bundle so that if the user rotates his/her phone in the middle of the quiz, then it'll keep it's place.

  12. labGeoQuiz

  13. how to copy files from a bc branch to a lb branch Actions || Open in Terminal git checkout c7c7 res/drawable-*/. git checkout c7c7 res/values/str* before a commit you may remove from stage, then: discard: for existing files that you want to roll back remove: for new files that you want to delete

More Related