SlideShare une entreprise Scribd logo
1  sur  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……..

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à Android programming

Similaire à 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
Android Android
Android
 

Dernier

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
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 

Dernier (20)

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
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 

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.