android erası 2 - ilk təlim

14
Rajab Davudov

Upload: orkhan-ahmadov

Post on 07-Jul-2015

2.249 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Android Erası 2 - ilk təlim

Rajab Davudov

Page 2: Android Erası 2 - ilk təlim

Agenda

• Eclipse, ADT and Android SDK• APK file• Fundamentals

– Activity– Service– Content Provider– Broadcast Receiver– Intent

• Hello World• Fake Login App• Play-Back Service

Page 3: Android Erası 2 - ilk təlim

Eclipse + ADT + Android SDK

• Download Eclipse IDE for Java Developers from http://eclipse.org/downloads/

• Menu [Help/Install New Software] add ADT site https://dl-ssl.google.com/android/eclipse/

• Download SDK

– Tools

– Android Platforms 4.0, 3.2, … ,2.3.3,2.2, …

– Extras

Page 4: Android Erası 2 - ilk təlim

APK File

• AndroidManifest.xml – Activity, Service etc. list

– Permissions and Features

• classes.dex– Dalvik bytecodes

• resources.arsc– Information about resources

• res/– Resource Files

Page 5: Android Erası 2 - ilk təlim

Activity

• An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map

• Each time a new activity starts, the previous activity is stopped, but the system preserves the activity in a stack (the "back stack").

• There are several callback methods that an activity might receive, due to a change in its state—whether the system is creating it, stopping it, resuming it, or destroying it

• You must declare your activity in the manifest file in order for it to be accessible to the system.

• You can start another activity by calling startActivity(), passing it an Intent that describes the activity you want to start.

Page 6: Android Erası 2 - ilk təlim
Page 7: Android Erası 2 - ilk təlim

Service

• A Service is an application component that can perform long-running operations inthe background and does not provide a user interface.

• Once started, a service can run in the background indefinitely, even if thecomponent that started it is destroyed.

• A bound service offers a client-server interface that allows components to interactwith the service, send requests, get results, and even do so across processes withinterprocess communication (IPC).

• onStartCommand() and onBind()

• Like activities (and other components), you must declare all services in yourapplication's manifest file.

Page 8: Android Erası 2 - ilk təlim
Page 9: Android Erası 2 - ilk təlim

Content Provider

• Content providers store and retrieve data and make it accessible to allapplications. They're the only way to share data across applications; there's nocommon storage area that all Android packages can access.

• How a content provider actually stores its data under the covers is up to itsdesigner. But all content providers implement a common interface for querying theprovider and returning results — as well as for adding, altering, and deleting data.

• Each content provider exposes a public URI (wrapped as a Uri object) that uniquelyidentifies its data set. android.provider.Contacts.Phones.CONTENT_URI

• Abstract methods– query()

– insert()

– update()

– delete()

– getType()

– onCreate()

Page 10: Android Erası 2 - ilk təlim

Broadcast Receiver

• A broadcast receiver is a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured.

• Although broadcast receivers don't display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs.

Page 11: Android Erası 2 - ilk təlim

Intent

• Three of the core components of an application — activities, services, and broadcast receivers — are activated through messages, called intents.

• The intent itself, an Intent object, is a passive data structure holding an abstract description of an operation to be performed.

• Contains– Component Name

– Action

– Data

– Extras

– Category

– Flags

Page 12: Android Erası 2 - ilk təlim

Practice Apps

• Hello World

• Fake Login App

• Play-Back Service

Page 13: Android Erası 2 - ilk təlim

Think, Design, Code !!!

Page 14: Android Erası 2 - ilk təlim

Rajab Davudov

Senior Developer at [email protected]

https://market.android.com/developer?pub=RADJAB

http://gplus.to/radjab

http://www.fb.me/rajab.davudov

http://www.linkedin.com/in/radjab

Market QR Code