Mobile Programming - Sharif University of...
Transcript of Mobile Programming - Sharif University of...
![Page 1: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/1.jpg)
MobileProgramming
Sharif University of Technology
Spring 2016
Lecture 2
Omid Jafarinezhad
![Page 2: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/2.jpg)
Android Studio
• Download Android Studiohttp://developer.android.com/sdk/index.html
![Page 3: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/3.jpg)
Installation of Android Studio
• On Windows: is simple, just lauch the .exe youdownloaded
• On Max OSX: drag and drop Android Studio intothe Applications folder
• On Linux: unpack the downloaded ZIP file into anappropriate location for your applications. Tolaunch Android Studio, navigate to the android-studio/bin/ directory in a terminal and executestudio.sh
![Page 4: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/4.jpg)
Configuration
• The first time you start Android Studio you canselect if you want to import your setting froman existing installation
![Page 5: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/5.jpg)
Setup guide
![Page 6: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/6.jpg)
Setup guide
![Page 7: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/7.jpg)
Setup guide
![Page 8: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/8.jpg)
Setup guide
![Page 9: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/9.jpg)
Android SDK Manager
![Page 10: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/10.jpg)
Install support library• The support library allows you to use
functionality provided by higher Androidreleases in lower Android versions
![Page 11: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/11.jpg)
Create a new Android project
• File → New Project...
![Page 12: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/12.jpg)
Create a new Android project
![Page 13: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/13.jpg)
Create a new Android project
![Page 14: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/14.jpg)
Create a new Android project
![Page 15: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/15.jpg)
Create a new Android project
![Page 16: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/16.jpg)
Review the generated project
![Page 17: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/17.jpg)
Create a virtual device (AVD)
• Define a new Android Virtual Device (AVD) by opening the AVD Manager via Tools → Android → AVD Manager
• Press the Create Virtual Device... button
![Page 18: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/18.jpg)
Create a virtual device (AVD)
![Page 19: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/19.jpg)
Create a virtual device (AVD)
![Page 20: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/20.jpg)
Create a virtual device (AVD)
![Page 21: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/21.jpg)
Create a virtual device (AVD)
![Page 22: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/22.jpg)
Start your virtual device
![Page 23: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/23.jpg)
Start the application on your virtual device
• Select Run → Run 'app' to start yourapplication. This opens a dialog in which youcan select your device to deploy yourapplication to.
![Page 24: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/24.jpg)
Start the application on your virtual device
![Page 25: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/25.jpg)
Eclipse ADT
• http://developer.android.com/tools/sdk/eclipse-adt.html
• https://marketplace.eclipse.org/content/android-development-tools-eclipse
![Page 26: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/26.jpg)
Eclipse ADT
• File-->New-->Other-->Android--> Android Application Project
![Page 27: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/27.jpg)
Create a new Android project
![Page 28: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/28.jpg)
Create a new Android project
![Page 29: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/29.jpg)
Create a new Android project
![Page 30: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/30.jpg)
Create a new Android project
![Page 31: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/31.jpg)
Review the generated project
![Page 32: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/32.jpg)
Run Android Application
![Page 33: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/33.jpg)
Create a virtual device (AVD)
![Page 34: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/34.jpg)
Create a virtual device (AVD)
![Page 35: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/35.jpg)
Create a virtual device (AVD)
![Page 36: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/36.jpg)
Logcat
![Page 37: Mobile Programming - Sharif University of Technologyce.sharif.edu/courses/94-95/2/ce327-1/resources/root/Lecture Notes... · Mobile Programming Author: omid Created Date: 2/27/2016](https://reader033.fdocuments.in/reader033/viewer/2022043013/5fadcc69a5c563498e2ab6b2/html5/thumbnails/37.jpg)
Run app