php - From where to start webservices in android? -


some people vote down after seeing these kinds of question. if votedown please tell reason may improve.

i learning android , started studying webservices.

i used php code

<?php  echo "hello abhi how you"; ?> 

and code in activity class of android application

public class mainactivity extends activity {          bufferedreader in = null;         textview tv1;         httpclient httpclient;         httppost httppost;           @override         protected void oncreate(bundle savedinstancestate) {                 super.oncreate(savedinstancestate);                 setcontentview(r.layout.activity_main);                 tv1 = (textview) findviewbyid(r.id.tv1);                 httpclient = new defaulthttpclient();                 httppost = new httppost("http://10.0.2.2/devilabhi/a.php");                 new getresult().execute();           }          @override         public boolean oncreateoptionsmenu(menu menu) {                 // inflate menu; adds items action bar if present.                 getmenuinflater().inflate(r.menu.main, menu);                 return true;         }          public class getresult extends asynctask<void, void, void>{                   string result = null;                 @override                 protected void doinbackground(void... arg0) {                         // todo auto-generated method stub                         try {                                 httpresponse response = httpclient.execute(httppost);                                 result = entityutils.tostring(response.getentity());                           } catch (exception e) {                                 // todo auto-generated catch block                                 e.printstacktrace();                                 log.e("exception", e.tostring());                         }                         return null;                 }                  @override                 protected void onpostexecute(void result1) {                         // todo auto-generated method stub                         super.onpostexecute(result1);                         tv1.settext(result);                         log.i("my response :: ", result);                 }          }  } 

and got output

enter image description here

now next step want learn how save name , email or else in database on server , how retrieve or must study else first may understand thing searched regarding , got link there no php code may not try code

is there website, link or example beginners study , learn webservices.

your suggestions , answers , valuable me , beginners me. in advance

the reason these downvoted asked without showing asker has put effort researching how things. you've @ least shown some, i'll give next steps.

1)sending parameters. you're going need choose whether use http or http post request. in get, parameters embedded in url- http://example.com?param1=val1&param2=val2 example. in post, they're embedded in request. there's reasons use each type, can google later.

2)on php side, can read values using $_get["param1"] or $_post["param1"] depending on way sent them.

3)you have connect database , write sql queries insert data. you're best off googling tutorial on using specific db , php here.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -