SlideShare a Scribd company logo
Android Application DevelopmentAndroid and InternetAhsanul Karimahsanul.karim@sentinelbd.comSentinel Solutions Ltd.http://www.sentinelbd.com
Connecting to the InternetHttp Connection ExampleIn this example we’ll see:How to use HttpClient object to send http requestsHow to get response data and show themFor manipulating HTTP requests/responses in an Android environment, the standard classes from the java.net package can be used. Thus, classes such as URL, URLConnection, HttpURLConnection etc., can all be used in the known way.
Connecting to the InternetHttp Connection ExampleWe’ll create a simple project to see HTTP Connection ExampleWe create a project with following:Project Name: HttpConnectionDemoBuild Target: 1.6Application name:HttpConnectionDemoPackage name: com.basistraining.httpdemoCreate Activity:HttpConnectionDemoActivityMin SDK Version: 4Add INTERNET permission
Connecting to the InternetHttp Connection ExampleWe’ll start with a class named HttpRetriever.In this class method: String retrieve (String url) will do the work
Connecting to the InternetHttp Connection ExampleNow from our main Activity, we’ll use this class. To input the url we make a layout
Connecting to the InternetHttp Connection ExampleNow we start with UI components
Connecting to the InternetHttp Connection ExampleOn button’s action, we add:
Connecting to the InternetHttp Connection ExampleNow we run
Connecting to the InternetHttp Connection ExampleNow we need to add some checks for internet connection
Connecting to the InternetHow to connect MySQL DB on Web serverWe have: a database named httptesta table named users with following fieldsId (integer)name (VARCHAR (50))email (VARCHAR (50))lat (VARCHAR (50))long (VARCHAR (50))We keep a very simple code in server side- connect to the database- run an SQL query- output it in JSON format
Connecting to the InternetHow to connect MySQL DB on Web serverAs response we get JSON data:[{“id”:”1”,"name":"john",       "email":"john@a.com",       "lat":"23.4567",       "long":"90.86777"},{“id”:”2”,"name":"smith",        "email":"smith@b.com",        "lat":"23.6767",        "long":"90.986765"}]
Connecting to the InternetParsing JSON Data

More Related Content

PPTX
Day 15: Content Provider: Using Contacts API
PPTX
Android Services
PPTX
Android Application Component: BroadcastReceiver Tutorial
PDF
Android Services and Managers Basic
PPTX
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
PDF
Lecture 2(b) Android Internals A Quick Overview
PPT
Android User Interface: Basic Form Widgets
PPTX
Android Intent.pptx
Day 15: Content Provider: Using Contacts API
Android Services
Android Application Component: BroadcastReceiver Tutorial
Android Services and Managers Basic
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Lecture 2(b) Android Internals A Quick Overview
Android User Interface: Basic Form Widgets
Android Intent.pptx

What's hot (20)

PDF
Day 8: Dealing with Lists and ListViews
PPTX
Develop a native application that uses GPS location.pptx
PPTX
Android Application that makes use of RSS Feed.pptx
PDF
Building a YellowAnt Application with Ruby on Rails
PPTX
Building a YellowAnt application with .NET
PPTX
Android Service
PDF
KingsleyUsen_SRS_Gmail
PDF
Android Service Intro
PPTX
Login and private message
PDF
Murach: How to transfer data from controllers
PDF
Murach: An introduction to web programming with ASP.NET Core MVC
PDF
Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB
PPTX
Mailing, the developer's eye view
PDF
Murach : How to work with session state and cookies
PDF
Murach : How to develop a single-page MVC web
PPTX
Request and response json
PPTX
Murach : HOW to work with controllers and routing
PDF
Murach: How to use Entity Framework EF Core
PPT
Best crm my salesdilaer
PDF
Facebook Login & Open Graph Introduction
Day 8: Dealing with Lists and ListViews
Develop a native application that uses GPS location.pptx
Android Application that makes use of RSS Feed.pptx
Building a YellowAnt Application with Ruby on Rails
Building a YellowAnt application with .NET
Android Service
KingsleyUsen_SRS_Gmail
Android Service Intro
Login and private message
Murach: How to transfer data from controllers
Murach: An introduction to web programming with ASP.NET Core MVC
Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB
Mailing, the developer's eye view
Murach : How to work with session state and cookies
Murach : How to develop a single-page MVC web
Request and response json
Murach : HOW to work with controllers and routing
Murach: How to use Entity Framework EF Core
Best crm my salesdilaer
Facebook Login & Open Graph Introduction
Ad

Viewers also liked (17)

PPTX
Android before getting started
PDF
Lecture 1 Session 1 Before Getting Started
PDF
AndroidManifest
PDF
Ui layout (incomplete)
PDF
Lecture 3 getting active through activities
PDF
Day1 before getting_started
PDF
GCM for Android
PPTX
Android Workshop Day 1 Part 2
PPTX
Mcq peresentation
PPTX
Introduction to Android Development: Before Getting Started
PPTX
Day 15: Working in Background
PPT
Day 3: Getting Active Through Activities
PDF
Day 1 Android: Before Getting Started
PDF
Lecture 5: Storage: Saving Data Database, Files & Preferences
PPT
Day: 2 Environment Setup for Android Application Development
PPT
Day 5: Android User Interface [View Widgets]
PPTX
Day 9: Make Your App Location Aware using Location API
Android before getting started
Lecture 1 Session 1 Before Getting Started
AndroidManifest
Ui layout (incomplete)
Lecture 3 getting active through activities
Day1 before getting_started
GCM for Android
Android Workshop Day 1 Part 2
Mcq peresentation
Introduction to Android Development: Before Getting Started
Day 15: Working in Background
Day 3: Getting Active Through Activities
Day 1 Android: Before Getting Started
Lecture 5: Storage: Saving Data Database, Files & Preferences
Day: 2 Environment Setup for Android Application Development
Day 5: Android User Interface [View Widgets]
Day 9: Make Your App Location Aware using Location API
Ad

Similar to Client-Server (20)

PPTX
Android Connecting to Internet
PDF
Android App Development 06 : Network & Web Services
PPTX
Great APIs
PPTX
Make Mobile Apps Quickly
KEY
Java web programming
PDF
Web Service and Mobile Integrated Day I
PPTX
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
PDF
Indroduction to Web Application
KEY
Android lessons you won't learn in school
PPTX
ql.io: Consuming HTTP at Scale
KEY
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
PDF
You're Going To Need A Bigger Toolbox
KEY
Modern Web Technologies — Jerusalem Web Professionals, January 2011
PPTX
Performance #4 network
PDF
Android Performance #4: Network
PDF
WebShell - confoo 2011 - sean coates
PPTX
Android and REST
PDF
Android dev 3
DOCX
Group project home management system
PDF
Top Ten Web Attacks
Android Connecting to Internet
Android App Development 06 : Network & Web Services
Great APIs
Make Mobile Apps Quickly
Java web programming
Web Service and Mobile Integrated Day I
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Indroduction to Web Application
Android lessons you won't learn in school
ql.io: Consuming HTTP at Scale
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
You're Going To Need A Bigger Toolbox
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Performance #4 network
Android Performance #4: Network
WebShell - confoo 2011 - sean coates
Android and REST
Android dev 3
Group project home management system
Top Ten Web Attacks

More from Ahsanul Karim (13)

PDF
লেকচার ১ (ক)- শুরুর আগে:
PDF
Day 8: Dealing with Lists and ListViews
PPT
Day 6: Android BroadcastReceiver Component
DOC
Day 4: Activity lifecycle
PPT
Day 4: Android: UI Widgets
PPT
Day 4: Android: Getting Active through Activities
PDF
Day 2 android internals a quick overview
PDF
Mobile Banking in Bangladesh: An Incomplete Study
PDF
List Views
PDF
Sensors in Android (old)
PPTX
Action Bar Sherlock tutorial
PPTX
Android Workshop: Day 1 Part 3
PPTX
Android 1.8 sensor
লেকচার ১ (ক)- শুরুর আগে:
Day 8: Dealing with Lists and ListViews
Day 6: Android BroadcastReceiver Component
Day 4: Activity lifecycle
Day 4: Android: UI Widgets
Day 4: Android: Getting Active through Activities
Day 2 android internals a quick overview
Mobile Banking in Bangladesh: An Incomplete Study
List Views
Sensors in Android (old)
Action Bar Sherlock tutorial
Android Workshop: Day 1 Part 3
Android 1.8 sensor

Recently uploaded (20)

PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Trump Administration's workforce development strategy
PDF
Classroom Observation Tools for Teachers
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Orientation - ARALprogram of Deped to the Parents.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Supply Chain Operations Speaking Notes -ICLT Program
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
O7-L3 Supply Chain Operations - ICLT Program
Final Presentation General Medicine 03-08-2024.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Chinmaya Tiranga quiz Grand Finale.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Trump Administration's workforce development strategy
Classroom Observation Tools for Teachers
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf

Client-Server

  • 1. Android Application DevelopmentAndroid and InternetAhsanul Karimahsanul.karim@sentinelbd.comSentinel Solutions Ltd.http://www.sentinelbd.com
  • 2. Connecting to the InternetHttp Connection ExampleIn this example we’ll see:How to use HttpClient object to send http requestsHow to get response data and show themFor manipulating HTTP requests/responses in an Android environment, the standard classes from the java.net package can be used. Thus, classes such as URL, URLConnection, HttpURLConnection etc., can all be used in the known way.
  • 3. Connecting to the InternetHttp Connection ExampleWe’ll create a simple project to see HTTP Connection ExampleWe create a project with following:Project Name: HttpConnectionDemoBuild Target: 1.6Application name:HttpConnectionDemoPackage name: com.basistraining.httpdemoCreate Activity:HttpConnectionDemoActivityMin SDK Version: 4Add INTERNET permission
  • 4. Connecting to the InternetHttp Connection ExampleWe’ll start with a class named HttpRetriever.In this class method: String retrieve (String url) will do the work
  • 5. Connecting to the InternetHttp Connection ExampleNow from our main Activity, we’ll use this class. To input the url we make a layout
  • 6. Connecting to the InternetHttp Connection ExampleNow we start with UI components
  • 7. Connecting to the InternetHttp Connection ExampleOn button’s action, we add:
  • 8. Connecting to the InternetHttp Connection ExampleNow we run
  • 9. Connecting to the InternetHttp Connection ExampleNow we need to add some checks for internet connection
  • 10. Connecting to the InternetHow to connect MySQL DB on Web serverWe have: a database named httptesta table named users with following fieldsId (integer)name (VARCHAR (50))email (VARCHAR (50))lat (VARCHAR (50))long (VARCHAR (50))We keep a very simple code in server side- connect to the database- run an SQL query- output it in JSON format
  • 11. Connecting to the InternetHow to connect MySQL DB on Web serverAs response we get JSON data:[{“id”:”1”,"name":"john", "email":"john@a.com", "lat":"23.4567", "long":"90.86777"},{“id”:”2”,"name":"smith", "email":"smith@b.com", "lat":"23.6767", "long":"90.986765"}]
  • 12. Connecting to the InternetParsing JSON Data