How to Declare a new HttpURLConnection

HttpURLConnection was added in API Level 1

1. In the MainActivity.java file, add the below line to the imports section.

import java.net.HttpURLConnection

2. In the onCreate method, add the following line. This will declare a new HttpURLConnection named myHttpURLConnection.

HttpURLConnection myHttpURLConnection; 

3. Compile and run!

Next Recommended Article: How to Get a new HttpURLConnection

Resources:
http://developer.android.com/reference/java/net/HttpURLConnection.html