android httpclient - new slide!
DESCRIPTION
Android HttpClient and PHP MySQL see more android/iOS application Development : http://adayd3sign.wordpress.com/ join me : http://www.brightest-idea.comTRANSCRIPT
Android Application Development Course
HttpClient and PHPMySQL
Mr.Chalermchon SommanaBrightest IDEA
Outline
●Day 1● Get start and setup android tool● Create simple application● Simple connection with PHP MySQL: select
●Day 2● Simple connection with PHP MySQL: select,insert, update, delete
● ListView and Custom Adapter
Overview: Connect PHP MySQL
MySQL
Delete
Update
Insert
Selectrequest
response Connect DB
Workshop
Output of Connect with PHP Present by ListView
Get Start
●Install Android SDK and Eclipse IDE●Install ADT in Eclipse●Create Simple application “Hello Android”●Android File and Folder System●manifest.xml, layout.xml, R.java●Basic UI●Using Android Simulator
Simple Application
●Activity●method: OnCreate●method: findViewById
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 contentInputStream in = httpEntity.getContent();BufferedReader read = new BufferedReader(new InputStreamReader(in));String content = "";String line = "";while((line = read.readLine())!=null){
content += line;}
Overview: Post Parameter
88
MySQLUpdate
Insert
Select
Request+parameter
response Connect DB
NameValuePair
Key + value param.add(new BasicNameValuePair("whereId", "19"));
$w = $_REQUEST[‘whereId’]
or$w = $_POST[‘whereId’]
Post Parameter (Code)
ArrayList<NameValuePair> param = new ArrayList<NameValuePair>();
//test select: whereId param.add(new BasicNameValuePair("whereId", "19"));
//add parameterhttpPost.setEntity(new UrlEncodedFormEntity(param));
Android Application Development Course
HttpClient and PHPMySQL
Contact usBrightest IDEA: http://www.brightest-idea.com
Mr.Chalermchon SommanaBlog: http://adayd3sign.wordpress.comThank you.