I'm new to Android and this is my first application. I'm to connect internet and download JSON from my companies server but unable to get input stream please check this code and provide me assistance.
URL url = new URL("http://www.android.com/");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.connect();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
URL is not the issue I have tested many URL's. In this code last line gives error. I uses open connectivity (No proxy only firewall) on my development machine and emulators browser is able to access internet.
I have already added
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
parallel to uses-sdk tag in Manifest file.