0

I am new to android networking and would like to find the best solution/source that would help me learn the same. I have a working android application but i want to include network services that can get and send data to the webserver. While i was searching for the same i found link ( http://www.helloandroid.com/tutorials/connecting-mysql-database ) which dont produce any results. I also found that SOAP or REST (with android) are probably recommended methods, if so please give complete tutorials to learn the same ( i have no prior knowledge on webservices). In my application I would be required to send data to the server and receive data from the servers sql

Thank you

user591124
  • 495
  • 2
  • 9
  • 23

1 Answers1

2

This is for post data on server,

  HttpClient httpclient = new DefaultHttpClient();
  HttpPost httppost = new HttpPost(url);  
  httppost.addHeader("Content-Type", "application/x-www-form-urlencoded");
  httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,HTTP.UTF_8));
     // Execute HTTP Post Request 
  HttpResponse response = httpclient.execute(httppost);         
     // get response entity 
  HttpEntity entity = response.getEntity();          
     // convert entity response to string  
  if (entity != null) 
     {      
      InputStream is = entity.getContent();     
       // convert stream to string    
       result = convertStreamToString(is);      
       result = result.replace("\n", "");     

}

or see how to post data to remote server in android app [closed], Post the data to Server

Community
  • 1
  • 1
user370305
  • 108,599
  • 23
  • 164
  • 151
  • If you find this is helpful to you please voteup and mark it as correct answer for other user. Thnx. – user370305 Aug 26 '11 at 19:53
  • This is very simple when you want to post something to server or make any request, for any file downloading, request for any data etc. And with the response you get the response of server or response for any data in any format like string or json. You can also use it for sending data to server in with bulkdata or in json format. Choice is your how to use it. You also look at the link a post in my answer. I think you begin with how to make http and server connection with android. Thnx. – user370305 Aug 27 '11 at 12:18