android app programming lecture 1
TRANSCRIPT
![Page 1: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/1.jpg)
Android App Programming
Lecture 1: Introduction, ActivitiesOctober 10, 2017
Thomas NowakUniversité Paris-Sud
![Page 2: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/2.jpg)
Course organization
• Classes Tuesday 1-4 pm in room I013-015
• Labs every week, right after lecture
• https://www.lri.fr/~nowak/teaching/android/
![Page 3: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/3.jpg)
Grading
1. Reading quizzes: 10%
2. Practical exam 1: 20%
3. Practical exam 2: 20%
4. Final project: 50%
![Page 4: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/4.jpg)
Reading quizzes
• Advance reading before each class
• Short quiz before lecture
• ~5 minutes on Moodle
• A few multiple choice questions each time
![Page 5: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/5.jpg)
Exams
• Two practical exams
• ~2 hours
• Create a small app
• Checks your understanding of the content of the preceding unit
![Page 6: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/6.jpg)
Course overview• Unit 1:
• Activities
• Intents
• Web services
• Asynchronous tasks
• Peripherals
• Databases
![Page 7: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/7.jpg)
Course overview• Unit 2:
• Android Runtime
• User Interface Design
• RESTful services
• Dealing with disconnectivity
• Testing and profiling
• Kotlin
![Page 8: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/8.jpg)
Course overview
• Unit 3:
• Design and develop your own app
• Groups of 4
• Version control via git
• Final presentations and demos
![Page 9: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/9.jpg)
Resources
• Android and Java APIs and documentation
• Book: Android Studio 3.0 Development Essentialsby Neil Smyth
• Lecture slides on course website
• Lots of online articles and tutorials
![Page 10: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/10.jpg)
Introduction
• Getting started with Android Studio
• Create first app
• Single screen app: single Activity
![Page 11: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/11.jpg)
App Inventor 2
• Online app creation tool
• Generates APKs
• Good for fast prototyping
• Graphical programming language
• Can become cumbersome for larger projects
![Page 12: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/12.jpg)
![Page 13: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/13.jpg)
![Page 14: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/14.jpg)
Java crash course
• Interfaces/classes:MainActivity extends AppCompatActivity
• Callbacks:boolean onOptionsItemSelected(MenuItem item)
• Lambda expressions:view -> System.out.println(view)
![Page 15: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/15.jpg)
Android Studio
• IDE for Android applications
• Includes management of virtual devices (emulator)
• Tools for testing, profiling, packaging, shipping
• Lots of tutorials on the web
![Page 16: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/16.jpg)
Layout files
• All UI elements can be created in Java code
• Most of the time, it isn’t
• Description in XML format
• Elements created at startup
![Page 17: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/17.jpg)
![Page 18: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/18.jpg)
R
• Dynamically generated class during compilation
• Links XML layout files to Java
• Contains all assets of the application (layout files, images, strings, etc.)
• Field names defined in layout editor
• Ex: R.id.toolbar
![Page 19: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/19.jpg)
Activities
• Single block of user interaction
• In the simplest case, one screen
• Can be a window or part of the screen
• To display something, set its content:
• setContentView(View)
![Page 20: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/20.jpg)
Views
• Basic UI component
• E.g., Button, TextView, ImageView, menus, etc.
• Has a set of mutable properties (e.g., text size)
• Can register listeners:
• button.setOnClickListener(this);
![Page 21: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/21.jpg)
Lab 1
1. Setup Android Studio on your machine with your device
2. Create a simple Activity and explore the layout editor
3. Add simple interactivity (a button)
![Page 22: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/22.jpg)
Advance reading
• Next week’s topic:
• Intents (a.k.a. switching Activities)
• Ch. 11.4–11.8 and 42.1–42.2 of Android Studio 3.0 Development Essentials
![Page 23: android app programming lecture 1](https://reader034.vdocuments.mx/reader034/viewer/2022051504/58677b0e1a28ab44568b6e0b/html5/thumbnails/23.jpg)
Questions