Skip to content
Advertisement

REST Server-Client Communication

I’m developing an Android app in Java and I need to add a REST Server-Client Communication feature to it. I assume that the following code should post data to a .php file and will be thankful if someone explains to me what does it do and how to use it properly:

JavaScript

Advertisement

Answer

My answer is in as comments in your code:

JavaScript

I hope this is helpfull. In general: postData make HTTP Post request on given URL. The code use method parameters as request body. If request returns 200 code, method returns response body as text, otherwise throws IOException.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement