Here's my code:
URL url = new URL("http://www.bing.com/");
URLConnection urlConnection = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) System.out.println(inputLine);
in.close();
In the manifest, I have this开发者_JAVA技巧:
<permission android:name="android.permission.INTERNET"></permission>
It is outside the application tab, but inside the manifest tag.
And the error I'm getting is this:
java.net.SocketException: Permission denied (maybe missing INTERNET permission)
Really not sure why I'm getting this error when I have the internet permission in place. A bit stumped here!
Thanks!
Shouldn't you have the following?
<uses-permission android:name="android.permission.INTERNET"/>
(Note the spelling modification between permission and uses-permission)
精彩评论