0

I'm trying to download a csv file from a website and am using the following code for that:

URL url = new URL(link);
URLConnection urlConnection = url.openConnection();
FileReader file = new FileReader((File) urlConnection.getContent());
CSVReader csvReader = new CSVReader (file);

But when I try to run this in the emulator it throws a Socket Exception. All searches I did for this exception said add the permission to use the internet in the manifest file. However even after doing that I still get the same error. I'm wondering if there is something in the emulator settings that might be needed to be changed. Because in my emulator the wifi connection is not highlighted.

Appreciate any help!

here is the error log that shows me that there is Wi-Fi driver failure on the emulator 05-20 15:37:32.065: ERROR/WifiService(57): Failed to load Wi-Fi driver. 05-20 15:37:33.245: ERROR/WifiService(57): Failed to load Wi-Fi driver. 05-20 15:37:34.145: ERROR/WifiService(57): Failed to load Wi-Fi driver.

kyle
  • 3
  • 2

1 Answers1

0

In your emulator, do you have all the correct Wifi/Internet options set? If so, check out this older posting Android: Simulate WiFi in the emulator?

Also, make sure you have the correct internet-related permissions in your Android Manifest file (and make sure they're set up properly in the XML!)

Community
  • 1
  • 1
Haphazard
  • 10,900
  • 6
  • 43
  • 55
  • Thanks for the feed back! I fixed it by deleting the old avd and making a new one. Sorry by the time i saw your reply I had already deleted to old one. – kyle May 20 '11 at 19:56
  • I know i'm kind of late but I should also say that the part of the problem was that the permission in the manifest file was inside the application tag... once you use the uses-permission outside of application tag it works perfectly. – kyle Jun 02 '11 at 19:28