performing a Http request on android
开发者_运维知识库Could someone provide the basic code to use if I want to perform a http request on android to the address "address" with the string "message" ? Also I'd like to check the server response and perform some actions if the right conditions meet , but I ' m unsure of how and when the server send back the response . My guess is that the response is gotten in a blocking function, or in an asynchronous function . Could you provide code or information on this as well ? Great thanks from a novice with too much on his head !
The above refers to a more complex asynchronous way, but if you want something simple and blocking, that is basic core java - http://developer.android.com/reference/java/net/URL.html
see URL.getContent(), etc.
精彩评论