1

I am attempting to use a yahoo finance api that returns a stock quote as a cvs file in Android. I've reduced the code down to:

HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet httpGet = new HttpGet("http://download.finance.yahoo.com/d/quotes.csv?s=msft&f=sl1p2");

I'm getting the following error "java.net.UnknownHostException: download.finance.yahoo.com"

The link works so I'm not sure why I'm getting the exception. Any help is appreciated.

3
  • If you're running this in the emulator, try restarting it. I get this problem very often. Also, if you're using a Mac, you might need to configure the interfaces. Commented Jun 5, 2011 at 5:27
  • Thanks, however, I'm using a phone and not an emulator. Commented Jun 5, 2011 at 5:29
  • 1
    For what it's worth after hours of looking at it, I had my permissions in the wrong place in the manifest.xml. Commented Jun 5, 2011 at 21:08

2 Answers 2

2

I had the same problem, by entering the following in AndroidManifest.xml solved it:

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

Sign up to request clarification or add additional context in comments.

Comments

0

Add the INTERNET permission to your manifest file. like below

<manifest xlmns:android...> ...
    <application android:label="@string/app_name" >...
    </application>    
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.