In many websites tutorials connection to a database of MySQL in Android uses httpclient class and name pair values ,which is deprecated by Google .So how to do it using volley or any other library.
Asked
Active
Viewed 907 times
1 Answers
0
If your posting is RESTful, you can probably consume the service with Spring for Android: http://projects.spring.io/spring-android/
Keep in ind although that this is build for Spring web services. You might need to tweak it to support your service and method. Also and generic Java HTTP client API can be used to post data including Apache Commons:
String myPostURL = "http://yoursite.com/yourPost";
RestTemplate template = new RestTemplate();
Object o res = postForObject(myPostURL, anObjectWithData, Object.class);
This will (if I am correct) POST form data to your url, and return an Object containing the response. You may or may not have to make sure that your Android data is posted as html form da.ta

Community
- 1
- 1

James Parsons
- 6,097
- 12
- 68
- 108
-
What is RESTful posting?Can you please explain. – mik dass Apr 03 '15 at 18:21
-
Are you using the standard http `POST` method? If so, then it is good. I probably shouldn't have said anything about RESTful because unless you are using SOAP or XML-RPC, or another protocol like that, then it *probably* is restful. – James Parsons Apr 03 '15 at 18:26
-
Yes i am using the standard http post method . – mik dass Apr 03 '15 at 18:38
-
Then as in my post, any generic Java HTTP library should be able to post data to your post url. – James Parsons Apr 03 '15 at 18:39
-
Please show me how to do it, – mik dass Apr 03 '15 at 18:42
-
If you look in my answer, it gives simple example, but I will mod it for you. If you are using Apache commons, see the link at the bottom. – James Parsons Apr 03 '15 at 18:43
-
1Anyways thanks for the link at the bottom .It kinds of provide a workable solution for me.Thanks again for the help. – mik dass Apr 03 '15 at 18:55