Returns the response code returned by the remote HTTP server.
Returns: the response code, -1 if no valid response code.
Throws: IOException - if there is an IO error during the retrieval.
1. Get a new HttpURLConnection
2. Create an Integer Variable named responseCode.
4. Add the below line in the try/catch right after you get a new HttpURLConnection above(in step #1). This must be in the try/catch statement.
responseCode = myHttpURLConnection.getResponseCode();
5. Compile and run!
Resources:
http://developer.android.com/reference/java/net/HttpURLConnection.html#getResponseCode()
https://www.tbray.org/ongoing/When/201x/2012/01/17/HttpURLConnection
http://developer.android.com/reference/java/net/HttpURLConnection.html#getResponseCode()
https://www.tbray.org/ongoing/When/201x/2012/01/17/HttpURLConnection