lecture 3 agenda revised setup android studio alt-views & shortcuts review layouts and resources...
TRANSCRIPT
![Page 1: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/1.jpg)
Lecture 3 agendarevised setupAndroid Studio alt-views & shortcutsreview layouts and resourcesdebugging in Android Studiolifecycle in Androidlab chapters 1-6
![Page 2: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/2.jpg)
Navigating in Android Studioalt-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-consolealt-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
![Page 3: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/3.jpg)
Get helpcntl-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
![Page 4: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/4.jpg)
Go to definition cntl-B (go directly to the method definition)
Javadocscntl-Q (open the javadocs)
Live Templatescntl-J
adding your own Live Templates (cntl-shift-A “live template”)
![Page 5: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/5.jpg)
DebuggingUsing 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
![Page 6: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/6.jpg)
Resources in Android
![Page 7: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/7.jpg)
![Page 8: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/8.jpg)
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.
![Page 9: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/9.jpg)
![Page 10: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/10.jpg)
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.
![Page 11: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/11.jpg)
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
![Page 12: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/12.jpg)
Lifecycle in Android
![Page 13: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/13.jpg)
![Page 14: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/14.jpg)
![Page 15: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/15.jpg)
![Page 16: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/16.jpg)
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.
![Page 17: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/17.jpg)
labGeoQuiz
![Page 18: Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters](https://reader036.vdocuments.us/reader036/viewer/2022062422/56649e9e5503460f94b9f666/html5/thumbnails/18.jpg)
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 backremove: for new files that you want to delete