SlideShare a Scribd company logo
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……..

More Related Content

PDF
Efficient Image Processing - Nicolas Roard
PDF
What's new in android 4.4 - Romain Guy & Chet Haase
PPTX
Application Development - Overview on Android OS
PDF
Android Development
PPTX
Android - Graphics Animation in Android
PDF
Android application development workshop day1
PDF
Android application development
DOCX
Android Basic Tutorial
Efficient Image Processing - Nicolas Roard
What's new in android 4.4 - Romain Guy & Chet Haase
Application Development - Overview on Android OS
Android Development
Android - Graphics Animation in Android
Android application development workshop day1
Android application development
Android Basic Tutorial

What's hot (8)

PPT
Android - Android Application Configuration
PDF
Mobile Application Development with JUCE and Native API’s
PPTX
iOS Development (Part 3) - Additional GUI Components
PPT
Android overview
PDF
The Glass Class - Tutorial 3 - Android and GDK
PDF
UIViewControllerのコーナーケース
PDF
Android dev o_auth
PPTX
Android Development project
Android - Android Application Configuration
Mobile Application Development with JUCE and Native API’s
iOS Development (Part 3) - Additional GUI Components
Android overview
The Glass Class - Tutorial 3 - Android and GDK
UIViewControllerのコーナーケース
Android dev o_auth
Android Development project
Ad

Viewers also liked (11)

PPT
Napkin instructions
PPTX
FS PPT Napkin Folding
PPT
HRMPS 13 - (MIDTERM) Chapter 3 Restaurant
PPTX
Napkin folding
PPTX
TABLE NAPKIN FOLDING (BBTE)
PPTX
Breakfast Service Sequence
PPTX
Different types of table napkin
PPTX
Table Napkin Folding
PDF
04 sequence of service
PPTX
F&b service operation(week2)
PPTX
HOSPITALITY FOOD & BEVERAGE SERVICE
Napkin instructions
FS PPT Napkin Folding
HRMPS 13 - (MIDTERM) Chapter 3 Restaurant
Napkin folding
TABLE NAPKIN FOLDING (BBTE)
Breakfast Service Sequence
Different types of table napkin
Table Napkin Folding
04 sequence of service
F&b service operation(week2)
HOSPITALITY FOOD & BEVERAGE SERVICE
Ad

Similar to Android programming (20)

PPTX
Android OS & SDK - Getting Started
PPT
PPT Companion to Android
PPTX
Introduction to android
ODP
Java Meetup - 12-03-15 - Android Development Workshop
PPTX
Presentation on Android application
PPT
Android-Tutorial.ppt
PPT
Android tutorial
PPT
Android tutorial
PPT
Android tutorial
PPT
Android tutorial
PPT
Android tutorial
PPTX
Technology and Android.pptx
PPTX
Android Applications Development: A Quick Start Guide
PPT
Android
PPT
Getting started with android dev and test perspective
PPT
Android In A Nutshell
PDF
Android dev o_auth
PPT
Android Introduction
PPTX
Android Basic
Android OS & SDK - Getting Started
PPT Companion to Android
Introduction to android
Java Meetup - 12-03-15 - Android Development Workshop
Presentation on Android application
Android-Tutorial.ppt
Android tutorial
Android tutorial
Android tutorial
Android tutorial
Android tutorial
Technology and Android.pptx
Android Applications Development: A Quick Start Guide
Android
Getting started with android dev and test perspective
Android In A Nutshell
Android dev o_auth
Android Introduction
Android Basic

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Complications of Minimal Access Surgery at WLH
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
master seminar digital applications in india
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Basic Mud Logging Guide for educational purpose
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
STATICS OF THE RIGID BODIES Hibbelers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
O7-L3 Supply Chain Operations - ICLT Program
human mycosis Human fungal infections are called human mycosis..pptx
Complications of Minimal Access Surgery at WLH
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Cell Types and Its function , kingdom of life
Microbial diseases, their pathogenesis and prophylaxis
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Sports Quiz easy sports quiz sports quiz
Anesthesia in Laparoscopic Surgery in India
2.FourierTransform-ShortQuestionswithAnswers.pdf
master seminar digital applications in india
GDM (1) (1).pptx small presentation for students
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Basic Mud Logging Guide for educational purpose
PPH.pptx obstetrics and gynecology in nursing
Pharma ospi slides which help in ospi learning
Pharmacology of Heart Failure /Pharmacotherapy of CHF

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.