• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Android basic principles
 

Android basic principles

on

  • 5,521 views

 

Statistics

Views

Total Views
5,521
Views on SlideShare
5,156
Embed Views
365

Actions

Likes
6
Downloads
0
Comments
1

3 Embeds 365

http://skillschool.co.in 203
http://www.skillschool.co.in 161
http://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • i need more detail about steganography

    can any one help..?
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Android basic principles Android basic principles Presentation Transcript

    • Android
      Architecture
    • Agenda
      The Virtual Machine
      The stack
      Android application (Part 1)
      Android application (Part 2, next time)
      Overview Presentation
      2
    • The Virtual Machine
      Overview Presentation
      3
    • The stack
      Overview Presentation
      4
    • The stack II
      Overview Presentation
      5
      Android is a layered environment built upon a foundation of Linux kernel. Android applications are written in Java programming language and they run in Dalvik Virtual Machine, an open source technology. Each Android application runs within an instance of the Dalvik VM, which in turn resides within a Linux-kernel managed process
    • The stack III
      Overview Presentation
      6
      Android platform layers:
    • The stack IV
      Overview Presentation
      7
      In more detail:
    • Application framework
      Overview Presentation
      8
      Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.
      Underlying all applications is a set of services and systems, including:
      A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser
      Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data
      A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files
      A Notification Manager that enables all applications to display custom alerts in the status bar
      An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack
    • Libraries
      System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices
      Media Libraries - based on PacketVideo'sOpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
      Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications
      LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view
      SGL - the underlying 2D graphics engine
      3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer
      FreeType - bitmap and vector font rendering
      SQLite - a powerful and lightweight relational database engine available to all applications
      Overview Presentation
      9
      Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework. Some of the core libraries are listed below:
    • What are the main components of a Android application
      Part I, today
      Short introduction in Eclipse
      AndroidManifest.xml
      Activity
      Intents
      Application resources
      Layouts
      Localization
      Part II, next time
      Application preferences
      App Widgets
      Services
      broadcast receivers
      content providers
      Overview Presentation
      10
    • What are the main components of a Android application
      Part I, today
      Short introduction in Eclipse
      AndroidManifest.xml
      Activity
      Intents
      Application resources
      Layouts
      Localization
      Part II, next time
      Application preferences
      App Widgets
      Services
      broadcast receivers
      content providers
      Overview Presentation
      11
    • Demo development envirioment
      Overview Presentation
      12
    • What are the main components of a Android application
      Part I, today
      Short introduction in Eclipse
      AndroidManifest.xml
      Activity
      Intents
      Application resources
      Layouts
      Localization
      Part II, next time
      Application preferences
      App Widgets
      Services
      broadcast receivers
      content providers
      Overview Presentation
      13
    • The AndroidManifest.xml File
      Overview Presentation
      14
      Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code.
      It names the Java package for the application. The package name serves as a unique identifier for the application.
    • The AndroidManifest.xml File
      It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched.
      It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.
      Overview Presentation
      15
    • The AndroidManifest.xml File
      It also declares the permissions that others are required to have in order to interact with the application's components.
      It declares the minimum level of the Android API that the application requires.
      It lists the libraries that the application must be linked against
      Overview Presentation
      16
      List is not complete !!!!!
    • Site step: What is API level?
      Overview Presentation
      17
      API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.
      The Android platform provides a framework API that applications can use to interact with the underlying Android system. The framework API consists of:
      • A core set of packages and classes
      • A set of XML elements and attributes for declaring a manifest file
      • A set of XML elements and attributes for declaring and accessing resources
      • A set of Intents
      • A set of permissions that applications can request, as well as permission enforcements included in the system
      Each successive version of the Android platform can include updates to the Android application framework API that it delivers.
    • Site step: permissions samples
      Overview Presentation
      18
      Location-based services android.permission.ACCESS_COARSE_LOCATION
      android.permission.ACCESS_FINE_LOCATION
      Accessing contact database android.permission.READ_CONTACTS
      android.permission.WRITE_CONTACTS
      Accessing calendars android.permission.READ_CALENDAR
      android.permission.WRITE_CALENDAR
      Changing general phone android.permission.SET_ORIENTATION
      settings android.permission.SET_TIME_ZONE
      android.permission.SET_WALLPAPER
      Making calls android.permission.CALL_PHONE
      android.permission.CALL_PRIVILEGED
    • Example AndroidManifest.xml
      Overview Presentation
      19
      <?xml version="1.0" encoding="utf-8"?>
      <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="eu.laracker"
      android:versionCode="1"
      android:versionName="1.0">
      <uses-sdkandroid:minSdkVersion="7" />
      <application android:icon="@drawable/icon" android:label="@string/app_name">
      <activity android:name=".SuperSocial"
      android:label="@string/app_name">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      </activity>
      </application>
      </manifest>
    • What are the main components of a Android application
      Part I, today
      Short introduction in Eclipse
      AndroidManifest.xml
      Activity
      Intents
      Application resources
      Layouts
      Localization
      Part II, next time
      Application preferences
      App Widgets
      Services
      broadcast receivers
      content providers
      Overview Presentation
      20
    • Activity
      An activity is a core component of the Android platform. Each activity represents a task the application can do, often tied to a corresponding screen in the application user interface.
      Activity is to an application what a web page is to a website. (Sort of)
      Overview Presentation
      21
    • Activities lifecycle
      Overview Presentation
      22
      Activities have a well defined lifecycle. The Android OS manages your activity by changing its state.
      Demo
    • What are the main components of a Android application
      Part I, today
      Short introduction in Eclipse
      AndroidManifest.xml
      Activity
      Intents
      Application resources
      Layouts
      Localization
      Part II, next time
      Application preferences
      App Widgets
      Services
      broadcast receivers
      content providers
      Overview Presentation
      23
    • Intents
      Overview Presentation
      24
      Intents are to Android apps what hyperlinks are to websites.
      An application can call directly a service or activity (explicit intent) or asked the Android system for registered services and applications for an intent (implicit intents).
      Intents are asynchronous messages.
    • Intents / Starting activities Samples
      Overview Presentation
      25
      Standard Explicit intents :
      Intent intent = new Intent(getApplicationContext(), HelpActivity.class);
      startActivity(intent);
      Extra parameters:
      Intent intent = new Intent(getApplicationContext(), HelpActivity.class);
      intent.putExtra(“eu.laracker.supersocial.LEVEL”, 8);
      startActivity(intent);
      Intent callingIntent = getIntent();
      inthelpLevel = callingIntent.getIntExtra(“eu.laracker.supersocial.LEVEL”, 1);
      Calling with result:
      startActivityForResult(new Intent(getApplicationContext(), HelpActivity.class);)
      onActivityResult(intrequestCode, intresultCode, Intent data);
    • Using Intents to Launch Other Applications
      Overview Presentation
      26
      Initially, an application may only be launching activity classes defined within its
      own package. However, with the appropriate permissions, applications may also
      launch external activity classes in other applications.
      Launching the built-in web browser and supplying a URL address
      Launching the web browser and supplying a search string
      Launching the built-in Dialer application and supplying a phone number
      Launching the built-in Maps application and supplying a location
      Launching Google Street View and supplying a location
      Launching the built-in Camera application in still or video mode
      Launching a ringtone picker
      Recording a sound
    • Using Intents to Launch Other Applications samples
      Overview Presentation
      27
      Launching the built-in web browser and supplying a URL address
      Implicit Intents:
      Uri address = Uri.parse(“http://www.planon-fm.com”);
      Intent surf = new Intent(Intent.ACTION_VIEW, address);
      startActivity(surf);
      AndroidManifest.xml
      <uses-permissionandroid:name="android.permission.INTERNET" />
      Which browser is openend is unknown, Android OS looks at the registered intend filters.
    • Registering via Intentfilter sample I
      Overview Presentation
      28
      This filter declares the main entry point of a application.
      • The standard MAIN action is an entry point that does not require any other information in the Intent (no data specification, for example).
      • The LAUNCHER category says that this entry point should be listed in the application launcher.
    • Registering via Intentfilter sample II
      Overview Presentation
      29
    • Site step: dialogs
      Overview Presentation
      30
      There are quite a few types of ready-made dialog types available for use in addition to the basic dialog. These are
      • AlertDialog ,
      • CharacterPickerDialog
      • DatePickerDialog,
      • ProgressDialog
      • TimePickerDialog.
      You can also create an entirely custom dialog by designing an XML layout file
      Demo
    • What are the main components of a Android application
      Part I, today
      Short introduction in Eclipse
      AndroidManifest.xml
      Activity
      Intents
      Application resources
      Layouts
      Localization
      Part II, next time
      Application preferences
      App Widgets
      Services
      broadcast receivers
      content providers
      Overview Presentation
      31
    • Examples of application resources
      Overview Presentation
      32
    • Application resources
      Overview Presentation
      33
      You should always externalize resources such as images and strings from your application code, so that you can maintain them independently. Externalizing your resources also allows you to provide alternative resources that support specific device configurations such as different languages or screen sizes
      Resource types are defined with special XML tags and organized into specially
      named project directories. Some examples of /res subdirectories are /drawable,
      /layout, and /values.
    • For any type of resource, you can specify default and multiple alternative resources for your application:
      • Default resources are those that should be used regardless of the device configuration or when there are no alternative resources that match the current configuration.
      • Alternative resources are those that you've designed for use with a specific configuration. To specify that a group of resources are for a specific configuration, append an appropriate configuration qualifier to the directory name.
      Application resources
      Overview Presentation
      34
      Demo
    • Sample resource file String
      Overview Presentation
      35
      You can use string resources anywhere your application needs to display text. You
      tag string resources with the <string> tag and store them in the resource file
      /res/values/strings.xml.
      <?xml version=”1.0” encoding=”utf-8”?>
      <resources>
      <string name=”app_name”>Name this App</string>
      <string name=”hello”>Hello</string>
      </resources>
      Referenced in XML: @string/hello
      Referenced in Java: getResources().getString(R.string.hello);
    • Sample resource file Drawable
      Overview Presentation
      36
      Drawable resources, such as image files, must be saved under the /res/drawable
      project directory.
      Referenced in XML: @drawable/icon
      Referenced in Java:
      logoView.setImageResource(R.drawable.icon);
      AndroidManifest.xml snippet:
      <application android:icon="@drawable/icon" android:label="@string/app_name">
    • Layouts (A world on his own)
      Overview Presentation
      37
      Layout files often define an entire screen and are associated with a specific activity,
      but they need not be. Layout resources can also define part of a screen and
      can be included within another layout.
      Layouts can also be created, modified, and used at runtime. However, in most
      cases, using the XML layout files greatly improves code clarity and reuse.
      Idea for next time ?????
    • What are the main components of a Android application
      Part I, today
      AndroidManifest.xml
      Activity
      Intents
      Application resources
      Layouts
      Localization
      Part II, next time
      Application preferences
      App Widgets
      Services
      broadcast receivers
      content providers
      Overview Presentation
      38
    • Example AndroidManifest.xml
      Overview Presentation
      39
      <?xml version="1.0" encoding="utf-8"?>
      <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="eu.laracker"
      android:versionCode="1"
      android:versionName="1.0">
      <uses-sdkandroid:minSdkVersion="7" />
      <application android:icon="@drawable/icon" android:label="@string/app_name">
      <activity android:name=".SuperSocial"
      android:label="@string/app_name">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      </activity>
      </application>
      </manifest>
    • Resources on the web
      http://developer.android.com/index.html
      http://www.vogella.de
      Tuturial
      http://developer.android.com/resources/tutorials/notepad/index.html
      Overview Presentation
      40
    • Henk Laracker Planon
      Thank you for your attention.