How to Check if Response Code is OK

public static final int HTTP_OK was added in API level 1
Numeric status code, 200: OK, Constant Value: 200 (0x000000c8)

1. Get the Respond Code Returned by a Remote HTTP server

2. In the try/catch created in step #1, add the below if/else code.

if (responseCode == HttpURLConnection.HTTP_OK) {
//Toast.makeText(this, "responseCode = HTTP_OK", Toast.LENGTH_LONG).show();
} else {
//Toast.makeText(this, "responsecode <> HTTP_OK!! Oh no Mr. Bill!", Toast.LENGTH_LONG).show();
}

3. Compile and run!

Next Recommended Article: How to Get Readable InputStream from URLConnection