SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
ANDROID

HTTPCLIENT & PHP
     MYSQL
     28Feb - 1Mar 2011
    ณ โรงพยาบาลรอยเอ็ด จังหวัดรอยเอ็ด



                                           Special Course
                                  วิทยากร เฉลิมชนม สมณะ
Outline
• Day 1
  – Get Start and Setup tool
  – Create Simple application
  – Simple Connect PHP MySQL: select

            • Day 2
               – Simple Connect PHP MySQL: select
                 insert update delete
               – ListView UI
                Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                                         2
                                 - 1 Mar
Example




Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                         3
                 - 1 Mar
Get Start
• Install SDK
• Install ADT in eclipse
• Create simple application “Hello World”
             – Android File & Folder: R.java
               manifestfile.xml layout.xml
             – Basic UI
             – How to use Simulator


                Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                                         4
                                 - 1 Mar
Simple Application
• Activity
• method: onCreate
• findViewByID




              Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                                       5
                               - 1 Mar
Connect PHP MySQL
• Overview
                                                      Select
                 request
                                     Insert
             response                                   Connect DB


                              Update
                                                       MySQL
                                Delete




             Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                                                     6
                              - 1 Mar
HttpClient (code)
//connect
• HttpClient httpClient = new DefaultHttpClient();
• HttpPost httpPost = new HttpPost(url);
• httpPost.setEntity(new UrlEncodedFormEntity(param));
• HttpResponse httpRespose = httpClient.execute(httpPost);
• HttpEntity httpEntity = httpRespose.getEntity();
//read content
• InputStream in = httpEntity.getContent();
• BufferedReader read = new BufferedReader(new InputStreamReader(in));
• String content = "";
• String line = "";
• while((line = read.readLine())!=null){
        content += line;
• }


                       Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                                                         7
                                        - 1 Mar
Post Parameter
   • Overview
                                                Key + value         $w = $_REQUEST[‘whereId’]
param.add(new BasicNameValuePair("whereId", "19"));                             or
                                                                    $w = $_POST[‘whereId’]
                                         NameValuePair
                                                 Request+parameter
                                                                                Insert

                                         response




                                                                       Update
                           Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                                                                         8
                                            - 1 Mar
Post Parameter (code)
• ArrayList<NameValuePair> param = new
   ArrayList<NameValuePair>();
//test select: whereId
• param.add(new BasicNameValuePair("whereId", "19"));

//add parameter
• httpPost.setEntity(new UrlEncodedFormEntity(param));




                    Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                                             9
                                     - 1 Mar
Thank
 You.


 Android: HTTPCLIENT & PHP MYSQL 28 Feb
                                          10
                  - 1 Mar

Weitere ähnliche Inhalte

Was ist angesagt?

Test and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppTest and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppMichele Capra
 
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech TalkHacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech TalkRed Hat Developers
 
Leveraging Azure Search in Your Application
Leveraging Azure Search in Your ApplicationLeveraging Azure Search in Your Application
Leveraging Azure Search in Your ApplicationJeremy Hutchinson
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code維佋 唐
 
Dependency injection in CakePHP
Dependency injection in CakePHPDependency injection in CakePHP
Dependency injection in CakePHPmarkstory
 
Building Android apps with Parse
Building Android apps with ParseBuilding Android apps with Parse
Building Android apps with ParseDroidConTLV
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3Luciano Mammino
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSScalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSCosmin Mereuta
 
Icinga2 api use cases
Icinga2 api use casesIcinga2 api use cases
Icinga2 api use casesroy peter
 
Spca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceSpca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceNCCOMMS
 
PUT Knowledge BUCKET Brain KEY Riak
PUT Knowledge BUCKET Brain KEY RiakPUT Knowledge BUCKET Brain KEY Riak
PUT Knowledge BUCKET Brain KEY RiakPhilipp Fehre
 
Android getting started
Android getting startedAndroid getting started
Android getting startedUptech
 
Additional action script 3.0
Additional action script 3.0Additional action script 3.0
Additional action script 3.0Brian Kelly
 

Was ist angesagt? (19)

Test and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppTest and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 App
 
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech TalkHacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
 
Leveraging Azure Search in Your Application
Leveraging Azure Search in Your ApplicationLeveraging Azure Search in Your Application
Leveraging Azure Search in Your Application
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
Goa tutorial
Goa tutorialGoa tutorial
Goa tutorial
 
Parse Advanced
Parse AdvancedParse Advanced
Parse Advanced
 
Firebase ng2 zurich
Firebase ng2 zurichFirebase ng2 zurich
Firebase ng2 zurich
 
Node.js and Parse
Node.js and ParseNode.js and Parse
Node.js and Parse
 
Dependency injection in CakePHP
Dependency injection in CakePHPDependency injection in CakePHP
Dependency injection in CakePHP
 
Building Android apps with Parse
Building Android apps with ParseBuilding Android apps with Parse
Building Android apps with Parse
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSScalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JS
 
#ajn3.lt.marblejenka
#ajn3.lt.marblejenka#ajn3.lt.marblejenka
#ajn3.lt.marblejenka
 
Icinga2 api use cases
Icinga2 api use casesIcinga2 api use cases
Icinga2 api use cases
 
Q
QQ
Q
 
Spca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceSpca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_service
 
PUT Knowledge BUCKET Brain KEY Riak
PUT Knowledge BUCKET Brain KEY RiakPUT Knowledge BUCKET Brain KEY Riak
PUT Knowledge BUCKET Brain KEY Riak
 
Android getting started
Android getting startedAndroid getting started
Android getting started
 
Additional action script 3.0
Additional action script 3.0Additional action script 3.0
Additional action script 3.0
 

Ähnlich wie Android httpclient php_mysql

Android Intermediatte IAK full
Android Intermediatte IAK fullAndroid Intermediatte IAK full
Android Intermediatte IAK fullAhmad Arif Faizin
 
Learn Spring Boot With Bisky - 3.pptx
Learn Spring Boot With Bisky - 3.pptxLearn Spring Boot With Bisky - 3.pptx
Learn Spring Boot With Bisky - 3.pptxMarshallChabaga
 
How to implement email functionalities with Mailjet api
How to implement email functionalities with Mailjet apiHow to implement email functionalities with Mailjet api
How to implement email functionalities with Mailjet apiE Boisgontier
 
SharePoint 2013 REST APIs
SharePoint 2013 REST APIsSharePoint 2013 REST APIs
SharePoint 2013 REST APIsGiuseppe Marchi
 
API Versioning in the Cloud
API Versioning in the CloudAPI Versioning in the Cloud
API Versioning in the CloudCloud Elements
 
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсКирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсScrumTrek
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Sumy PHP User Grpoup
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersKevin Hazzard
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Mario Cardinal
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP TutorialLorna Mitchell
 
RedisConf18 - Open Source Built for Scale: Redis in Amazon ElastiCache Service
RedisConf18 - Open Source Built for Scale: Redis in Amazon ElastiCache ServiceRedisConf18 - Open Source Built for Scale: Redis in Amazon ElastiCache Service
RedisConf18 - Open Source Built for Scale: Redis in Amazon ElastiCache ServiceRedis Labs
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIKevin Hazzard
 

Ähnlich wie Android httpclient php_mysql (20)

Android httpclient
Android httpclientAndroid httpclient
Android httpclient
 
Android Intermediatte IAK full
Android Intermediatte IAK fullAndroid Intermediatte IAK full
Android Intermediatte IAK full
 
Android intermediatte Full
Android intermediatte FullAndroid intermediatte Full
Android intermediatte Full
 
Learn Spring Boot With Bisky - 3.pptx
Learn Spring Boot With Bisky - 3.pptxLearn Spring Boot With Bisky - 3.pptx
Learn Spring Boot With Bisky - 3.pptx
 
How to implement email functionalities with Mailjet api
How to implement email functionalities with Mailjet apiHow to implement email functionalities with Mailjet api
How to implement email functionalities with Mailjet api
 
SharePoint 2013 REST APIs
SharePoint 2013 REST APIsSharePoint 2013 REST APIs
SharePoint 2013 REST APIs
 
API Versioning in the Cloud
API Versioning in the CloudAPI Versioning in the Cloud
API Versioning in the Cloud
 
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсКирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
The Materials API
The Materials APIThe Materials API
The Materials API
 
Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for Beginners
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
RedisConf18 - Open Source Built for Scale: Redis in Amazon ElastiCache Service
RedisConf18 - Open Source Built for Scale: Redis in Amazon ElastiCache ServiceRedisConf18 - Open Source Built for Scale: Redis in Amazon ElastiCache Service
RedisConf18 - Open Source Built for Scale: Redis in Amazon ElastiCache Service
 
Androidphpmysql
AndroidphpmysqlAndroidphpmysql
Androidphpmysql
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web API
 
RESTing with JAX-RS
RESTing with JAX-RSRESTing with JAX-RS
RESTing with JAX-RS
 

Kürzlich hochgeladen

Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Kürzlich hochgeladen (20)

Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Android httpclient php_mysql

  • 1. ANDROID HTTPCLIENT & PHP MYSQL 28Feb - 1Mar 2011 ณ โรงพยาบาลรอยเอ็ด จังหวัดรอยเอ็ด Special Course วิทยากร เฉลิมชนม สมณะ
  • 2. Outline • Day 1 – Get Start and Setup tool – Create Simple application – Simple Connect PHP MySQL: select • Day 2 – Simple Connect PHP MySQL: select insert update delete – ListView UI Android: HTTPCLIENT & PHP MYSQL 28 Feb 2 - 1 Mar
  • 3. Example Android: HTTPCLIENT & PHP MYSQL 28 Feb 3 - 1 Mar
  • 4. Get Start • Install SDK • Install ADT in eclipse • Create simple application “Hello World” – Android File & Folder: R.java manifestfile.xml layout.xml – Basic UI – How to use Simulator Android: HTTPCLIENT & PHP MYSQL 28 Feb 4 - 1 Mar
  • 5. Simple Application • Activity • method: onCreate • findViewByID Android: HTTPCLIENT & PHP MYSQL 28 Feb 5 - 1 Mar
  • 6. Connect PHP MySQL • Overview Select request Insert response Connect DB Update MySQL Delete Android: HTTPCLIENT & PHP MYSQL 28 Feb 6 - 1 Mar
  • 7. HttpClient (code) //connect • HttpClient httpClient = new DefaultHttpClient(); • HttpPost httpPost = new HttpPost(url); • httpPost.setEntity(new UrlEncodedFormEntity(param)); • HttpResponse httpRespose = httpClient.execute(httpPost); • HttpEntity httpEntity = httpRespose.getEntity(); //read content • InputStream in = httpEntity.getContent(); • BufferedReader read = new BufferedReader(new InputStreamReader(in)); • String content = ""; • String line = ""; • while((line = read.readLine())!=null){ content += line; • } Android: HTTPCLIENT & PHP MYSQL 28 Feb 7 - 1 Mar
  • 8. Post Parameter • Overview Key + value $w = $_REQUEST[‘whereId’] param.add(new BasicNameValuePair("whereId", "19")); or $w = $_POST[‘whereId’] NameValuePair Request+parameter Insert response Update Android: HTTPCLIENT & PHP MYSQL 28 Feb 8 - 1 Mar
  • 9. Post Parameter (code) • ArrayList<NameValuePair> param = new ArrayList<NameValuePair>(); //test select: whereId • param.add(new BasicNameValuePair("whereId", "19")); //add parameter • httpPost.setEntity(new UrlEncodedFormEntity(param)); Android: HTTPCLIENT & PHP MYSQL 28 Feb 9 - 1 Mar
  • 10. Thank You. Android: HTTPCLIENT & PHP MYSQL 28 Feb 10 - 1 Mar