mobile programming - sharif university of...

37
Mobile Programming Sharif University of Technology Spring 2016 Lecture 2 Omid Jafarinezhad

Upload: others

Post on 12-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Start the application on your virtual device

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

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

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

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

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

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

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

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

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

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

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

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

Run app