filip debelić [email protected]. what is it? android is a mobile operating system (os) based on the...

15
Filip Debelić [email protected]

Upload: barnaby-norton

Post on 19-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Filip Debelić[email protected]

Page 2: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

What is it?

• Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google• Android, Inc. was founded in Palo Alto, California in October 2003• Google acquired Android Inc. on August 17, 2005. with it’s key

employees• On November 5, 2007, the Open Handset Alliance unveiled itself and

unveiled Android• The first commercially available smartphone running Android was the

HTC Dream released in 2008

CS Computer Systems © 2015

Page 3: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Why Android?

• Android takes more then 80% of smartphone market• Android powers hundreds of millions of mobile devices in more than

190 countries• every day another million users power up their Android devices

for the first time• powerful development framework• open marketplace for distributing your apps• over one million Android applications published• 1.5 billion application downloaded every month

CS Computer Systems © 2015

Page 4: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Android SDK

• Android software development kit (SDK) includes a comprehensive set of development tools• SDK manager, AVD manager, debugger, libraries, a handset emulator,

documentation, sample code and tutorials

• until the end of 2014, the officially supported integrated development environment (IDE) was Eclipse (using the Android Development Tools (ADT) Plugin), but IntelliJ IDEA IDE and NetBeans IDE (via plugin) also supported Android development• Android applications are packaged in .apk

CS Computer Systems © 2015

Page 5: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Android Studio

• Android Studio is the official IDE for Android application development, based on IntelliJ IDEA• Gradle-based build system• Build variants and multiple apk file generation• layout editor• lint tools• ProGuard and app-signing capabilities

CS Computer Systems © 2015

Page 6: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

• java folder - java source code in packages• res folder - resources• drawable: pictures, icon, drawable xml• layout: xml files describing screen components• menu: xml files describing menus• Values: xml resources with text, colors,

dimensions, ids etc.

• AndroidManifest.xml - application configuration• build.gradle – build configuration • proguard-rules.pro – proguard

configuration

CS Computer Systems © 2015

Page 7: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

User interface

• Android user interface is build using widgets (View) and layouts (ViewGroup)• All user interface elements have:• Id to excess element from source code• Position of element on screen• Padding around element• Background picture or color• onClick that defines method name for click event• Rotation in degrees• Visibility that can be visible, invisible or gone

CS Computer Systems © 2015

Page 8: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Layouts

• LinearLayout - a layout that organizes its children into a single horizontal or vertical row.

• RelativeLayout - enables you to specify the location of child objects relative to each or to the parent

• FrameLayout - designed to block out an area on the screen to display a single item

CS Computer Systems © 2015

Page 9: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Widgets

• TextView - element for displaying text• EditText - an editable text field• Button - a push-button that can be pressed, or clicked, by the user to

perform an action.• Checkbox - an on/off switch that can be toggled by the user.• RadioButton - Similar to checkboxes, except that only one option can

be selected in the group.• ImageView – element for displaying image• ProgressBar - visual indicator of progress in some operation

CS Computer Systems © 2015

Page 10: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Activity

• An Activity is an application component that provides a screen with which users can interact in order to do something• An application usually consists of multiple activities, and typically one

activity is specified as the "main" activity• Each time a new activity starts, the previous activity is stopped, but

the system preserves the activity in a stack

CS Computer Systems © 2015

Page 11: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Activity lifecycle

CS Computer Systems © 2015

Page 12: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Creating an Activity

• create a subclass of Activity (or an existing subclass of it)• implement callback methods that the system calls when the activity

transitions between various states of its lifecycle• onCreate() - the system calls this when creating your activity• onPause() - the system calls this method as the first indication that the user is

leaving your activity

• implement a user interface• define a layout using views is with an XML layout file saved in your application

resources• set the layout as the UI for your activity with setContentView()

• declaring the activity in the manifest

CS Computer Systems © 2015

Page 13: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Intent

• An intent is an abstract description of an operation to be performed, a messaging object you can use to request an action from another app component• Explicit intents specify the component to start by name• Implicit intents declare a general action to perform• You can add extra data with various putExtra() methods, and get extra

data with various getExtra() methods

CS Computer Systems © 2015

Page 14: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Exercise

• Create Eggspert application for calculating time for egg cooking. Values that user must enter are:• m – egg weight• tE – egg temperature before putting in water• tW – water temperature• tT – target egg temperature

• Application must have two activities, one for entering input data and other for showing result• Time is calculating with form:

time = 0.451 * Math.pow(m, 2.0 / 3.0) * Math.log(0.76 * ((tE - tW) / (tT - W)));

CS Computer Systems © 2015

Page 15: Filip Debelić fdebelic@cs.hr. What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,

Thank you

• Dropbox link:• https://www.dropbox.com/s/k56iwgy208a5lqy/MyFirstApplication.zip?dl=0

• Android developer:• http://developer.android.com/index.html

CS Computer Systems © 2015