SlideShare uma empresa Scribd logo
1 de 22
Android Programming
• An Introduction ---
• Android is an
• Operating system
• Developed by Google
• For use in Notebooks
• & Mobile Phones.
Introduction
 Android is a software bunch comprising not only
operating system but also middleware and key
applications. Android Inc was founded in Palo
Alto of California, U.S. by Andy Rubin, Rich
miner, Nick sears and Chris White in 2003. Later
Android Inc. was acquired by Google in 2005.
After original release there have been number of
updates in the original version of Android.
 It is Java based and supports the
Google APIs
Main Features of
Android
 Application framework enabling reuse and replacement of components.
 Dalvik virtual machine optimized for mobile devices.
 Integrated browser based on the open source WebKit engine .
 Optimized graphics powered by a custom 2D graphics library; 3D
graphics based on the OpenGL ES 1.0 specification (hardware
acceleration optional).
 SQLite for structured data storage.
 Media support for common audio, video, and still image formats
(MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF).
 GSM Telephony (hardware dependent).
 Bluetooth, EDGE, 3G, and Wi-Fi (hardware dependent).
 Camera, GPS, compass, and accelerometer (hardware dependent).
 Rich development environment including a device emulator, tools for
debugging, memory and performance profiling, and a plug-in for the
Eclipse IDE.
Android Framework
Google APIs in Android
 Google APIs Add-On is an extension to the Android SDK development environment that lets you
develop applications for devices that include Google's set of custom applications, libraries, and
services. A central feature of the add-on is the Maps external library, which lets you add powerful
mapping capabilities to your Android application.
 The add-on also provides a compatible Android system image that runs in the Android Emulator,
which lets you debug, profile, and test your application before publishing it to users. The system
image includes the the Maps library and other custom system components that your applications
may need, to access Google services (such as Android C2DM). The add-on does not include any
custom Google applications. When you are ready to publish your application, you can deploy it to
any Android-powered device that runs a compatible version of the Android platform and that also
includes the custom Google components, libraries, and services.
 The Google APIs add-on includes:
 The Maps external library
 The USB Open Accessory Library (only with API Levels 10 and 12+)
 A fully-compliant Android system image (with the Maps library and other custom system
components built in)
 A sample Android application called MapsDemo
 Full Maps library documentation
Google Cloud API
 Android Cloud to Device Messaging Framework
 Android Cloud to Device Messaging (C2DM) is a
service that helps developers send data from
servers to their applications on Android devices.
The service provides a simple, lightweight
mechanism that servers can use to tell mobile
applications to contact the server directly, to
fetch updated application or user data. The
C2DM service handles all aspects of queueing of
messages and delivery to the target application
running on the target device.
Using Google Maps API
• Build location-based apps
• Build maps for mobile apps
• Visualize Geospatial Data Create 3D images
with the Earth API, heat maps in Fusion Tables
• Customize your maps Create customized maps
that highlight your data, imagery, and brand.
Google Earth API
Google Earth API
 Google Earth is available in Android Market
on most devices that have Android 2.1 or
later versions. So as devices such as Droid get
updated to Android 2.1, others will also be
able to fly to the far reaches of the globe with
a swipe of their finger.
Google Earth for Nexus One is used in the
Android Market.
Google Search API
• Google search and Google image search are
both available for Android.
• Free licensing is provided for
1000 searches per day.
Animations in Android
• Animations are supported in Android
both programmatically and directively.
Android Animation
Example (1)
 HypatiaBasicAnimationActivity.java
 package hypatia.animation.basic;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
public class HypatiaBasicAnimationActivity extends Activity {
 /** Called when the activity is first created. */
 static HypatiaAnimationView v;
static int[] colors={Color.WHITE,Color.YELLOW,Color.MAGENTA,Color.GREEN,Color.RED};
static int colorno=0;
@Override
public void onCreate(Bundle savedInstanceState) {
//This is the first method to be executed
super.onCreate(savedInstanceState);
v=new HypatiaAnimationView(this);//Create the view and store it in a static variable for further use
setContentView(v);//Make this view the current view. This means that whenever the view is invalidated it's onDraw method will be called
}
Android Animation
Example (1)
Android Animation
Example (2)
 public class HypatiaAnimationView extends View implements AnimationListener {
String themessage="Reserve your right to think, for even to think wrongly is better than not to think at all.";
public HypatiaAnimationView(Context context) {
super(context);
paint = new Paint();
paint.setColor(HypatiaBasicAnimationActivity.colors[HypatiaBasicAnimationActivity.colorno]);
HypatiaBasicAnimationActivity.colorno=(HypatiaBasicAnimationActivity.colorno + 1) %
HypatiaBasicAnimationActivity.colors.length;
// TODO Auto-generated constructor stub
}
Paint paint;//The paint object for the drawing
@Override
public void onDraw(Canvas canvas)
{
super.onDraw(canvas);
if (hypatiaanimationset == null) {//If the animation set is null, create it
//***********************Create the Animation Set****************************
{
hypatiaanimationset=new AnimationSet(true);
animation = new AlphaAnimation(1F, 0F);
animation.setRepeatMode(Animation.REVERSE);
animation.setRepeatCount(Animation.INFINITE);
animation.setDuration(5000);
animation.setAnimationListener(this);
Data Access in
Android
• Android comes with a inbuilt SQLite
database.
• SQLite is a software library that implements a
self-contained, serverless, zero-configuration,
transactional SQL database engine. SQLite is
the most widely deployed SQL database
engine in the world. The source code for
SQLite is in the public domain.
Main Feature of SQLite
 Main Feature of SQLite:-
 Transactions are atomic, consistent, isolated, and durable (ACID) even after system crashes and power failures.
 Zero-configuration - no setup or administration needed.
 Implements most of SQL92. (Features not supported)
 A complete database is stored in a single cross-platform disk file.
 Supports terabyte-sized databases and gigabyte-sized strings and blobs. (See limits.html.)
 Small code footprint: less than 350KiB fully configured or less than 200KiB with optional features omitted.
 Faster than popular client/server database engines for most common operations.
 Simple, easy to use API.
 Written in ANSI-C. TCL bindings included. Bindings for dozens of other languages available separately.
 Well-commented source code with 100% branch test coverage.
 Available as a single ANSI-C source-code file that you can easily drop into another project.
 Self-contained: no external dependencies.
 Cross-platform: Unix (Linux, Mac OS-X, Android, iOS) and Windows (Win32, WinCE, WinRT) are supported out of
the box. Easy to port to other systems.
 Sources are in the public domain. Use for any purpose.
 Comes with a standalone command-line interface (CLI) client that can be used to administer SQLite databases.
A Simple Android SQL Lite
Program(1)
 android.database.sqlite.SQLiteOpenHelper
This class needs to be subclassed to provide for creation of the database.
It has two methods
@Override
public void onCreate(SQLiteDatabase database) {
//Called when the database is created.
}
@Override
public void onUpgrade(SQLiteDatabase database, int oldversion, int newversion) {
//Called when the database is upgraded.
}
 android.database.sqlite.SQLiteDatabase
Encapsulates a connection to a SQLite database and provides methods for sending queries to the
Database and recovering the result.
android.database.Cursor 
This class provides methods for accessing the results of a select query.It can be compared to the
java.sql.ResultSet.
A Simple Android SQL Lite
Program(2)
 if(b.equals(bttncreate))
{
try
{
database.execSQL( "create table HypatiaBooks(bookname text primary key,price integer not null )");
txtResult.setText("Table Created");
}
catch (Exception ex) {
// TODO: handle exception
txtResult.setText(ex.getMessage());
}
}
if(b.equals(bttninsert))
{
try
{
String bookname="" + txtBookName.getText();
bookname=bookname.replaceAll("'", "''").trim();
String price="" + txtPrice.getText();
price=price.replaceAll("'","''").trim();
database.execSQL("insert into HypatiaBooks values('" + bookname + "'," + price + ")");
txtResult.setText("Data Inserted");
}
catch (Exception ex) {
// TODO: handle exception
txtResult.setText(ex.getMessage());
}
}
}
A Simple Android SQL Lite
Program(3)
 if(b.equals(bttnselect))
{
try
{
String bookname="" + txtBookName.getText();
bookname=bookname.replaceAll("'", "''").trim();
String[] columns={"Price"};
String selection="BookName='"+ bookname + "'";
cursor= database.query("HypatiaBooks", columns, selection, null, null, null, null);
if(cursor==null)
{
txtResult.setText("No Data Found");
return;
}
if(cursor.moveToFirst())
{
int price=cursor.getInt(0);
txtPrice.setText("" + price);
txtResult.setText("Data Selected");
}
else
txtResult.setText("No Data Found");
cursor.close();
}
catch (Exception ex) {
// TODO: handle exception
txtResult.setText(ex.getMessage());
}
}
Web Services in
Android
• A Web Service is a XML based system for
implementing Remote Procedure Calls.
• It uses SOAP , the Simple Object Access
Protocol for accessing the Remote Object.
• The WSDL or Web Services description
Language is used to describe the methods in
the Web Service.
Web Services in
Android
 @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        try
        {
        String namespace = "http://tempuri.org/";
        String url ="http://hypatiasoftwaresolutions.com/HypatiaQuotesService.asmx?WSDL";    
        String soapaction = "http://tempuri.org/getBirthday";
        String methodname = "getBirthday";
        SoapObject request = new SoapObject(namespace, methodname);     
        request.addProperty("name","" + txtname.getText());
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
        envelope.dotNet=true;
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE (url);
        
            androidHttpTransport.call(soapaction, envelope);
            org.ksoap2.serialization.SoapObject resultsRequestSOAP =(org.ksoap2.serialization.SoapObject) envelope.bodyIn;
            txtBirthday.setText("" + resultsRequestSOAP.getProperty(0));
        }
        catch(Exception ex)
        {
            tv.setText("" + ex);
        }
    }
}
Conclusion
 Android is a truly open, free developement platform based on linux
and open source. Handset makers can use and customize the
platform without paying a royalty.
 A component-based architecture inspired by Internet mash-ups.
parts of one application can be used in another in ways not
originally envisioned by the developer. can use even replace built-
in components with own improved version.
 This will unleash a new round of creativity in the mobile space.
 Android is open to all : industry, developers and users.
 Participating in many of the successful open source projects.
 Aims to be as easy to build for as the web.
 Google Android is stepping into the next level of mobile Internet.
THANK YOU……..

Mais conteúdo relacionado

Mais procurados

Mobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’sMobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’sAdam Wilson
 
iOS Development (Part 3) - Additional GUI Components
iOS Development (Part 3) - Additional GUI ComponentsiOS Development (Part 3) - Additional GUI Components
iOS Development (Part 3) - Additional GUI ComponentsAsim Rais Siddiqui
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKGun Lee
 
UIViewControllerのコーナーケース
UIViewControllerのコーナーケースUIViewControllerのコーナーケース
UIViewControllerのコーナーケースKatsumi Kishikawa
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_authlzongren
 
Android Development project
Android Development projectAndroid Development project
Android Development projectMinhaj Kazi
 

Mais procurados (8)

Android - Android Application Configuration
Android - Android Application ConfigurationAndroid - Android Application Configuration
Android - Android Application Configuration
 
Mobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’sMobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’s
 
iOS Development (Part 3) - Additional GUI Components
iOS Development (Part 3) - Additional GUI ComponentsiOS Development (Part 3) - Additional GUI Components
iOS Development (Part 3) - Additional GUI Components
 
Android overview
Android overviewAndroid overview
Android overview
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDK
 
UIViewControllerのコーナーケース
UIViewControllerのコーナーケースUIViewControllerのコーナーケース
UIViewControllerのコーナーケース
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Android Development project
Android Development projectAndroid Development project
Android Development project
 

Destaque

Napkin instructions
Napkin  instructionsNapkin  instructions
Napkin instructionsJemmy Eepana
 
FS PPT Napkin Folding
FS PPT Napkin FoldingFS PPT Napkin Folding
FS PPT Napkin Foldingbsed3a
 
HRMPS 13 - (MIDTERM) Chapter 3 Restaurant
HRMPS 13 - (MIDTERM) Chapter 3   RestaurantHRMPS 13 - (MIDTERM) Chapter 3   Restaurant
HRMPS 13 - (MIDTERM) Chapter 3 RestaurantBean Malicse
 
Napkin folding
Napkin foldingNapkin folding
Napkin folding96vidya
 
TABLE NAPKIN FOLDING (BBTE)
TABLE NAPKIN FOLDING (BBTE)TABLE NAPKIN FOLDING (BBTE)
TABLE NAPKIN FOLDING (BBTE)jhovy_barias
 
Different types of table napkin
Different types of table napkinDifferent types of table napkin
Different types of table napkinWynne Li
 
F&b service operation(week2)
F&b service operation(week2)F&b service operation(week2)
F&b service operation(week2)nyc_naomi
 
HOSPITALITY FOOD & BEVERAGE SERVICE
HOSPITALITY FOOD & BEVERAGE SERVICE HOSPITALITY FOOD & BEVERAGE SERVICE
HOSPITALITY FOOD & BEVERAGE SERVICE Brahmas Pandey
 

Destaque (11)

Napkin instructions
Napkin  instructionsNapkin  instructions
Napkin instructions
 
FS PPT Napkin Folding
FS PPT Napkin FoldingFS PPT Napkin Folding
FS PPT Napkin Folding
 
HRMPS 13 - (MIDTERM) Chapter 3 Restaurant
HRMPS 13 - (MIDTERM) Chapter 3   RestaurantHRMPS 13 - (MIDTERM) Chapter 3   Restaurant
HRMPS 13 - (MIDTERM) Chapter 3 Restaurant
 
Napkin folding
Napkin foldingNapkin folding
Napkin folding
 
TABLE NAPKIN FOLDING (BBTE)
TABLE NAPKIN FOLDING (BBTE)TABLE NAPKIN FOLDING (BBTE)
TABLE NAPKIN FOLDING (BBTE)
 
Breakfast Service Sequence
Breakfast Service SequenceBreakfast Service Sequence
Breakfast Service Sequence
 
Different types of table napkin
Different types of table napkinDifferent types of table napkin
Different types of table napkin
 
Table Napkin Folding
Table Napkin FoldingTable Napkin Folding
Table Napkin Folding
 
04 sequence of service
04  sequence of service04  sequence of service
04 sequence of service
 
F&b service operation(week2)
F&b service operation(week2)F&b service operation(week2)
F&b service operation(week2)
 
HOSPITALITY FOOD & BEVERAGE SERVICE
HOSPITALITY FOOD & BEVERAGE SERVICE HOSPITALITY FOOD & BEVERAGE SERVICE
HOSPITALITY FOOD & BEVERAGE SERVICE
 

Semelhante a Android programming

Semelhante a Android programming (20)

Android OS & SDK - Getting Started
Android OS & SDK - Getting StartedAndroid OS & SDK - Getting Started
Android OS & SDK - Getting Started
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development WorkshopJava Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development Workshop
 
Presentation on Android application
Presentation on Android applicationPresentation on Android application
Presentation on Android application
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android-Tutorial.ppt
Android-Tutorial.pptAndroid-Tutorial.ppt
Android-Tutorial.ppt
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Technology and Android.pptx
Technology and Android.pptxTechnology and Android.pptx
Technology and Android.pptx
 
Android Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start GuideAndroid Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start Guide
 
Android
AndroidAndroid
Android
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
 
Project
ProjectProject
Project
 
Android Basic
Android BasicAndroid Basic
Android Basic
 

Último

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 

Último (20)

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 

Android programming

  • 1. Android Programming • An Introduction --- • Android is an • Operating system • Developed by Google • For use in Notebooks • & Mobile Phones.
  • 2. Introduction  Android is a software bunch comprising not only operating system but also middleware and key applications. Android Inc was founded in Palo Alto of California, U.S. by Andy Rubin, Rich miner, Nick sears and Chris White in 2003. Later Android Inc. was acquired by Google in 2005. After original release there have been number of updates in the original version of Android.  It is Java based and supports the Google APIs
  • 3. Main Features of Android  Application framework enabling reuse and replacement of components.  Dalvik virtual machine optimized for mobile devices.  Integrated browser based on the open source WebKit engine .  Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional).  SQLite for structured data storage.  Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF).  GSM Telephony (hardware dependent).  Bluetooth, EDGE, 3G, and Wi-Fi (hardware dependent).  Camera, GPS, compass, and accelerometer (hardware dependent).  Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plug-in for the Eclipse IDE.
  • 5. Google APIs in Android  Google APIs Add-On is an extension to the Android SDK development environment that lets you develop applications for devices that include Google's set of custom applications, libraries, and services. A central feature of the add-on is the Maps external library, which lets you add powerful mapping capabilities to your Android application.  The add-on also provides a compatible Android system image that runs in the Android Emulator, which lets you debug, profile, and test your application before publishing it to users. The system image includes the the Maps library and other custom system components that your applications may need, to access Google services (such as Android C2DM). The add-on does not include any custom Google applications. When you are ready to publish your application, you can deploy it to any Android-powered device that runs a compatible version of the Android platform and that also includes the custom Google components, libraries, and services.  The Google APIs add-on includes:  The Maps external library  The USB Open Accessory Library (only with API Levels 10 and 12+)  A fully-compliant Android system image (with the Maps library and other custom system components built in)  A sample Android application called MapsDemo  Full Maps library documentation
  • 6. Google Cloud API  Android Cloud to Device Messaging Framework  Android Cloud to Device Messaging (C2DM) is a service that helps developers send data from servers to their applications on Android devices. The service provides a simple, lightweight mechanism that servers can use to tell mobile applications to contact the server directly, to fetch updated application or user data. The C2DM service handles all aspects of queueing of messages and delivery to the target application running on the target device.
  • 7. Using Google Maps API • Build location-based apps • Build maps for mobile apps • Visualize Geospatial Data Create 3D images with the Earth API, heat maps in Fusion Tables • Customize your maps Create customized maps that highlight your data, imagery, and brand.
  • 9. Google Earth API  Google Earth is available in Android Market on most devices that have Android 2.1 or later versions. So as devices such as Droid get updated to Android 2.1, others will also be able to fly to the far reaches of the globe with a swipe of their finger. Google Earth for Nexus One is used in the Android Market.
  • 10. Google Search API • Google search and Google image search are both available for Android. • Free licensing is provided for 1000 searches per day.
  • 11. Animations in Android • Animations are supported in Android both programmatically and directively.
  • 12. Android Animation Example (1)  HypatiaBasicAnimationActivity.java  package hypatia.animation.basic; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; public class HypatiaBasicAnimationActivity extends Activity {  /** Called when the activity is first created. */  static HypatiaAnimationView v; static int[] colors={Color.WHITE,Color.YELLOW,Color.MAGENTA,Color.GREEN,Color.RED}; static int colorno=0; @Override public void onCreate(Bundle savedInstanceState) { //This is the first method to be executed super.onCreate(savedInstanceState); v=new HypatiaAnimationView(this);//Create the view and store it in a static variable for further use setContentView(v);//Make this view the current view. This means that whenever the view is invalidated it's onDraw method will be called } Android Animation Example (1)
  • 13. Android Animation Example (2)  public class HypatiaAnimationView extends View implements AnimationListener { String themessage="Reserve your right to think, for even to think wrongly is better than not to think at all."; public HypatiaAnimationView(Context context) { super(context); paint = new Paint(); paint.setColor(HypatiaBasicAnimationActivity.colors[HypatiaBasicAnimationActivity.colorno]); HypatiaBasicAnimationActivity.colorno=(HypatiaBasicAnimationActivity.colorno + 1) % HypatiaBasicAnimationActivity.colors.length; // TODO Auto-generated constructor stub } Paint paint;//The paint object for the drawing @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); if (hypatiaanimationset == null) {//If the animation set is null, create it //***********************Create the Animation Set**************************** { hypatiaanimationset=new AnimationSet(true); animation = new AlphaAnimation(1F, 0F); animation.setRepeatMode(Animation.REVERSE); animation.setRepeatCount(Animation.INFINITE); animation.setDuration(5000); animation.setAnimationListener(this);
  • 14. Data Access in Android • Android comes with a inbuilt SQLite database. • SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.
  • 15. Main Feature of SQLite  Main Feature of SQLite:-  Transactions are atomic, consistent, isolated, and durable (ACID) even after system crashes and power failures.  Zero-configuration - no setup or administration needed.  Implements most of SQL92. (Features not supported)  A complete database is stored in a single cross-platform disk file.  Supports terabyte-sized databases and gigabyte-sized strings and blobs. (See limits.html.)  Small code footprint: less than 350KiB fully configured or less than 200KiB with optional features omitted.  Faster than popular client/server database engines for most common operations.  Simple, easy to use API.  Written in ANSI-C. TCL bindings included. Bindings for dozens of other languages available separately.  Well-commented source code with 100% branch test coverage.  Available as a single ANSI-C source-code file that you can easily drop into another project.  Self-contained: no external dependencies.  Cross-platform: Unix (Linux, Mac OS-X, Android, iOS) and Windows (Win32, WinCE, WinRT) are supported out of the box. Easy to port to other systems.  Sources are in the public domain. Use for any purpose.  Comes with a standalone command-line interface (CLI) client that can be used to administer SQLite databases.
  • 16. A Simple Android SQL Lite Program(1)  android.database.sqlite.SQLiteOpenHelper This class needs to be subclassed to provide for creation of the database. It has two methods @Override public void onCreate(SQLiteDatabase database) { //Called when the database is created. } @Override public void onUpgrade(SQLiteDatabase database, int oldversion, int newversion) { //Called when the database is upgraded. }  android.database.sqlite.SQLiteDatabase Encapsulates a connection to a SQLite database and provides methods for sending queries to the Database and recovering the result. android.database.Cursor  This class provides methods for accessing the results of a select query.It can be compared to the java.sql.ResultSet.
  • 17. A Simple Android SQL Lite Program(2)  if(b.equals(bttncreate)) { try { database.execSQL( "create table HypatiaBooks(bookname text primary key,price integer not null )"); txtResult.setText("Table Created"); } catch (Exception ex) { // TODO: handle exception txtResult.setText(ex.getMessage()); } } if(b.equals(bttninsert)) { try { String bookname="" + txtBookName.getText(); bookname=bookname.replaceAll("'", "''").trim(); String price="" + txtPrice.getText(); price=price.replaceAll("'","''").trim(); database.execSQL("insert into HypatiaBooks values('" + bookname + "'," + price + ")"); txtResult.setText("Data Inserted"); } catch (Exception ex) { // TODO: handle exception txtResult.setText(ex.getMessage()); } } }
  • 18. A Simple Android SQL Lite Program(3)  if(b.equals(bttnselect)) { try { String bookname="" + txtBookName.getText(); bookname=bookname.replaceAll("'", "''").trim(); String[] columns={"Price"}; String selection="BookName='"+ bookname + "'"; cursor= database.query("HypatiaBooks", columns, selection, null, null, null, null); if(cursor==null) { txtResult.setText("No Data Found"); return; } if(cursor.moveToFirst()) { int price=cursor.getInt(0); txtPrice.setText("" + price); txtResult.setText("Data Selected"); } else txtResult.setText("No Data Found"); cursor.close(); } catch (Exception ex) { // TODO: handle exception txtResult.setText(ex.getMessage()); } }
  • 19. Web Services in Android • A Web Service is a XML based system for implementing Remote Procedure Calls. • It uses SOAP , the Simple Object Access Protocol for accessing the Remote Object. • The WSDL or Web Services description Language is used to describe the methods in the Web Service.
  • 20. Web Services in Android  @Override     public void onClick(View arg0) {         // TODO Auto-generated method stub         try         {         String namespace = "http://tempuri.org/";         String url ="http://hypatiasoftwaresolutions.com/HypatiaQuotesService.asmx?WSDL";             String soapaction = "http://tempuri.org/getBirthday";         String methodname = "getBirthday";         SoapObject request = new SoapObject(namespace, methodname);              request.addProperty("name","" + txtname.getText());         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);          envelope.dotNet=true;         envelope.setOutputSoapObject(request);         HttpTransportSE androidHttpTransport = new HttpTransportSE (url);                      androidHttpTransport.call(soapaction, envelope);             org.ksoap2.serialization.SoapObject resultsRequestSOAP =(org.ksoap2.serialization.SoapObject) envelope.bodyIn;             txtBirthday.setText("" + resultsRequestSOAP.getProperty(0));         }         catch(Exception ex)         {             tv.setText("" + ex);         }     } }
  • 21. Conclusion  Android is a truly open, free developement platform based on linux and open source. Handset makers can use and customize the platform without paying a royalty.  A component-based architecture inspired by Internet mash-ups. parts of one application can be used in another in ways not originally envisioned by the developer. can use even replace built- in components with own improved version.  This will unleash a new round of creativity in the mobile space.  Android is open to all : industry, developers and users.  Participating in many of the successful open source projects.  Aims to be as easy to build for as the web.  Google Android is stepping into the next level of mobile Internet.