• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

unknownhostexception

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am attempting to retrieve a file from a URL connection. I've looked at all of the examples on the 'Net and have copied some in, but I simply can't figure out why I'm getting a "unknownhostexception" when running this code. I've tried multiple URL's - java.com, www.oracle.com, and the one in the example below, and they all return the unknownhostexception when doing the getInputStream function. Can someone please help me? I get this error right after the message indicated by #0 below appears.

 
Chuck Jagger
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry..I should have included a couple more items of interest: 1) I'm developing this under the Android SDK. 2) I've tried running this application on both my development machine and on my android (both of which can access the URL) 3) I've verified that both my Droid as well as my development machine can reach all of the URL's that I've tried.
 
Chuck Jagger
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK...after lots of searching and searching, I finally found the answer.

To do Internet communication in an Android app, this line must be in the AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

this goes just before the <application tagl
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.
Its great you solved it, and also shared the solution with others

We have a forum dedicated to Android questions. I will move this topic there for you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic