*
First, Android wants to access the network and needs to add network access to the Androidmanifest.xml.
1,get: For example this url,http://i.cnblogs.com/editposts.aspx?opt=1
The Get method is also spliced into a request URL like this, the Address bar connection parameter
Get Connected
HttpURLConnection conn= (httpurlconnection) New URL (Url.tostring ()). OpenConnection ();
Conn.setconnectiontimeout (5000);
Conn.setrequestmethod ("GET");
2,post: The data sent consists of two aspects: HTTP request Header, Entity data (Form a=1&b=3)
In the request header, Content-type,content-length is required (other fields can be viewed through the HttpWatch tool)
It is then similar to the Get method and also constructs the Entity data
Then get the connection conn, get the output stream through the connection, write the Entity data out
?? Post to output stream, write data outward
Note details: The conn request has not been sent correctly, and can be triggered by invoking an API that obtains a return parameter.
It's too lazy to think, I asked you to the result, you started to work
*
Network communication through the Get/post way to submit parameters to the Web application