20

Click here to load reader

Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

  • Upload
    lamnhu

  • View
    214

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Chapter 1: Voilà! Meet the Android

Page 2: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Meet the Android

• Smartphones – Can browse the Web – Allow you to play games – Use business applications – Check e-mail – Play music – Record video – Map locations with GPS – Oh yes, make phone calls and send text messages

2 Android Boot Camp for Developers using Java

Page 3: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Meet the Android (continued)

– Android phone platform runs a free, open-source operating system from Google

– Open Handset Alliance • 80 companies that develop standards for mobile

devices

• Android Phone Device – Most popular are EVO, Droid, Galaxy, Echo, etc. – OS also powers tablets, netbooks, e-readers, MP4

players and Internet TVs

3 Android Boot Camp for Developers using Java

Page 4: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Meet the Android (continued)

• Features of the Android – Flash support - Flash video plays within the Android

Web browser. (The iPhone does not support Flash capabilities.)

– Power management - Android identifies programs running in the background using memory and processor resources.

– Optimized gaming - Android supports the use of gyroscope, gravity, barometric sensors, linear acceleration, and rotation vector.

4 Android Boot Camp for Developers using Java

Page 5: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Meet the Android (continued)

• Features of the Android (continued)

– Onscreen keyboard - Spell-check, predictive text, voice-input mode.

– Wi-Fi Internet tethering - Allows a phone to be used as a wireless or wired hot spot.

– Multiple language support - Android supports multiple human languages.

– Front- and rear-facing cameras – Voice-based recognition for calling, texting, and

navigating with the phone.

5 Android Boot Camp for Developers using Java

Page 6: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Meet the Android (continued)

• Features of the Android (continued)

– 3D graphics - The interface can support 3D graphics for a 3D interactive game experience or 3D image rendering.

– Facial recognition - Android provides this high-level feature for automatically identifying or verifying a person’s face from a digital image or a video frame.

6 Android Boot Camp for Developers using Java

Page 7: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Meet the Android (continued)

• Writing Android Apps – Java is the language of choice for Android Apps – Object-oriented programming languages allow for

good software engineering practices • Eclipse

– The most popular tool (IDE) for writing Java programs

– Can also be used to develop applications in other languages

– XML is used to assist in the layout of the Android emulator

7 Android Boot Camp for Developers using Java

Page 8: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Meet the Android (continued)

• Android Emulator – Design, develop, prototype, and test Android apps

without using a physical device – Mimics almost every feature of a real Android

handset, except placing phone calls – Current version is Ice Cream Sandwich – all

versions named after dessert items (in alphabetical order)

– Previous versions include Cupcake, Donut, Éclair, Froyo (frozen yogurt), Gingerbread, and Honeycomb

8 Android Boot Camp for Developers using Java

Page 9: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Meet the Android (continued)

• Getting Oriented with Market Deployment – Platform consists of the Android OS, application

development tools, and a marketplace Apps are compiled into package files with an .apk extension

– Android Market (http://market.android.com) sells and deploys all apps

– Programs must meet minimum standards – Apps are free or paid (70/30 split between developer

and wireless carrier) – Also sold through Amazon (amazon.com/appstore)

and iTunes (both charge a $99 registration fee)

9 Android Boot Camp for Developers using Java

Page 10: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

• Building the User Interface – Must be intuitive – Interface must not distract from functionality – Java code or XML layout files are needed

• XML method is preferred • Can design interface without writing large amounts of

code

10 Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 11: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

• Taking a Tour of the Package Explorer – Src folder – contains Java source code – Gen folder – contains automatically generated Java

files – Android 4.0 library – contains all class libraries – Assets folder – contains asset files – Res folder – contains images, music, and video – Android Manifest.xml – contains information about

the application that Android needs to run

11 Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 12: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

• Designing the user Interface Layout – Layout – a container that holds as many widgets as

needed – Widget– a single element on the screen (Button,

Text Box, etc.) • Also called an object

12 Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 13: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

13

Figure 1-10 Layout Displayed in Eclipse Window

Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 14: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

• Adding a Form Widget to the User Interface Layout

14

Figure 1-12 TextView form widget in the emulator

Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 15: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

• Adding a Form Widget to the User Interface Layout

15

Figure 1-14 Changing the TextView control text Figure 1-15 Displaying the revised text in the emulator

Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 16: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

• Testing the Application in the Emulator

16

Figure 1-16 Run As Dialog Box

Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 17: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

• Testing the Application in the Emulator

17

Figure 1-17 Android main screen and lock icon Figure 1-18 Message in the Android Emulator

Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 18: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

• Opening a Saved App in Eclipse

18

Figure 1-19 Import dialog box Figure 1-20 Project and directory selected

Android Boot Camp for Developers using Java

First Venture into the Android World (cont’d)

Page 19: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Summary

• Android OS is released under Apache license allowing anyone to get the full open-source for free

• Android OS powers all types of mobile devices • To write apps, you can use Eclipse, an IDE used

for building applications • The Android emulator lets you design, develop

prototype, and test Android applications • The Android platform consists of the Android OS,

the Android application development platform, and the Android marketplace

19 Android Boot Camp for Developers using Java

Page 20: Chapter 1: Voilà! Meet the Android - Cerritos Collegeweb.cerritos.edu/pnguyen/SitePages/cis288/lecturenotes/ch01.pdfChapter 1: Voilà! Meet the Android . Meet the Android ... •

Summary (continued)

• Android supports both Java code and XML layout files, although XML is preferred

• The Package Explorer contains folders for an Android project

• To design a user interface for an Android app, you can create a layout containing widgets (objects)

• The Android emulator allows you to test an application and make sure it runs correctly

20 Android Boot Camp for Developers using Java