Download - Android Introduction
A mobile phone that is able to perform many of the
functions of a computer, typically having an operating
system capable of running general-purpose applications
What is Smart Phone?
• An open source, open platform for mobile development.
• All the SDK, API, and platform source is available.
• No licensing, no app review.
• Replace any system app with your own.
What is Android?
Android API Versions
• Motion sensors
• Environmental sensors
• Position sensors
Sensors in Android Device
• Accelerometer
It is used to present landscape or portrait views of the device's screen, based
on the way the device is being held.
• Gyroscope
The gyroscope measures the rate or rotation in rad/s around a device's x, y,
and z axis.
• Rotation Vector Sensor
The rotation vector represents the orientation of the device as a combination
of an angle and an axis.
Motion sensors
• Humidity Sensor
• Light Sensors
• Pressure Sensors
• Temperature Sensors
Environment Sensors
• Orientation Sensor
Monitor the position of a device relative to the earth's frame of reference.
• Geomagnetic Field Sensor
Monitor changes in the earth's magnetic field.
• Proximity Sensor
It determine how far away an object is from a device.
Position Sensors
Screen Orientation
Complete About Android
Company / developer Google & Open Handset Alliance
Written in C (Core), C++, Java (User Interface)
OS family Unix-like
Source model Open source and in most devices with proprietary components
License Apache License 2.0 & Modified Linux kernel under GNU GPL v2
Initial release September 23, 2008
Latest release 4.4.2 KitKat/ December 9, 2013
Marketing target Smartphones & Tablet computers
Available in Multi-lingual (46 languages)
Package manager Google Play, APK
Supported platforms 32-bit ARM, MIPS, x86
Kernel type Monolithic (modified Linux kernel)
Default user interface Graphical (Multi-touch)
Developer Tools• Eclipse + ADT plugin
• Android SDK Tools
• Android Platform-tools
• The latest Android platform
• The latest Android system image for the emulator
• Android Studio
The Basic Steps
The Basic Steps
The Basic Steps
Application Fundamentals• Activities
• Services
• Content providers
• Broadcast receivers
• The Manifest File
Application Fundamentals• User Interface
• App Resources
• Animation and Graphics
• Computation
• Media and Camera
• Location and Sensors
• Connectivity
• Text and Input
• Data Storage
The Manifest File• Every application must have an AndroidManifest.xml file.
• It presents essential information about the application.
Structure of the Manifest File
<?xml version="1.0" encoding="utf-8"?><manifest>
<uses-permission /><uses-sdk />:<application>
<activity><intent-filter>
<action /><category />
</intent-filter></activity>::
</application></manifest>
Activities• An Activity is an application component that provides a
screen with which users can interact in order to do
something
Creating an Activity:
1. Create a subclass of android.app.Activity (i.e extend android.app.Activity)
2. Override onCreate() method
3. setContentView() to define the layout
Manifest.xml<activity android:name=".ExampleActivity" android:icon="@drawable/app_icon">
<intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" />
</intent-filter></activity>
Managing the Activity Lifecycle1. Resumed
2. Paused
3. Stopped
LayoutsA layout defines the visual structure for a user interface.
• Declare UI elements in XML.
• Instantiate layout elements at runtime.
Common Layouts
Linear Layout Relative Layout Web View
A layout that organizes its children into a single horizontal or vertical row. It creates a scrollbar if the length of the window exceeds the length of the screen.
Enables you to specify the location of child objects relative to each other (child A to the left of child B) or to the parent (aligned to the top of the parent).
Displays web pages.
Building Blocks
Your inventory of ready-to-use elements for creating outstanding apps.
Widgets (Controls)1. Button
2. Text field
• EditText
• AutoCompleteTextView
3. Checkbox
4. Radio button
• RadioButton
• Toggle button
5. Toggle button
6. Spinner
7. Toasts
8. Seek Bars and Sliders
9. Pickers
• DatePicker
• TimePicker
Buttons• A button consists of text or an icon (or both text and an
icon) that communicates what action occurs when the user
touches it.
<Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/button_text"... />
Text Fields• A text field allows the user to type text into your app.
<EditTextandroid:id="@+id/email_address"android:layout_width="fill_parent"android:layout_height="wrap_content"android:hint="@string/email_hint"android:inputType="textEmailAddress" />
android:inputType• “text"
Normal text keyboard.
• "textEmailAddress"
Normal text keyboard with the @ character.
• "textUri"
Normal text keyboard with the / character.
• "number"
Basic number keypad.
• "phone"
Phone-style keypad.
Checkbox• Checkboxes allow the user to select one or more options
from a set. Typically, you should present each checkbox
option in a vertical list.
<CheckBox android:id="@+id/checkbox_meat"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/meat"... />
Radio Buttons• Radio buttons allow the user to select one option from a
set. <RadioGroup>android:layout_width="fill_parent"android:layout_height="wrap_content"android:orientation="vertical"><RadioButton android:id="@+id/radio_pirates"
android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/pirates"android:onClick="onRadioButtonClicked"/>
<RadioButton android:id="@+id/radio_ninjas"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/ninjas"android:onClick="onRadioButtonClicked"/>
</RadioGroup>
Toggle Buttons• A toggle button allows the user to change a setting
between two states.
<ToggleButtonandroid:id="@+id/togglebutton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textOn="Vibrate on"android:textOff="Vibrate off"android:onClick="onToggleClicked"/>
Toggle buttons
Switches (in Android 4.0+)
Spinners• Spinners provide a quick way to select one value from a set.
<Spinnerandroid:id="@+id/planets_spinner"android:layout_width="fill_parent"android:layout_height="wrap_content" />
Toasts• A toast provides simple feedback about an operation in a
small popup.
Context context = getApplicationContext();String text = "Hello toast!";int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);toast.show();
Dialogs• Dialogs prompt the user for decisions or additional
information required by the app to continue a task.
1. Optional title region 2. Content area 3. Action buttons
Seek Bars and Sliders• Interactive sliders make it possible to select a value from a
continuous or discrete range of values by moving the slider
thumb.
Pickers• Pickers provide a simple way to select a single value from a
set.
Date & Time Pickers:
Google Services
Build new revenue streams, manage app distribution, track
app usage, and enhance your app with features such as
maps, sign-in, and cloud messaging.
Google Services
Google Maps Google Play In-App Billing
Google Wallet Instant Buy
Google Cloud Messaging
Google Analytics
Google Cloud Platform
Google Mobile Ads
Google+
Google Play Game Services
Location APIs
Nexus Family
Android Wear
Google Glass
Follow us: /+GdgvijayawadaBlogspot
/GDGVijayawada
/GDGVijayawada