I'm using windows vista and Eclipse for developing. I write the simple
code to download a file and store it on my sd card. But i'm getting
exception (File not found exception)
Here is my code

 public void downloadNewapk () {
                 try {
                        URL url = new URL(apkURL.toString());
                        HttpsURLConnection c = (HttpsURLConnection)
url.openConnection();
                        c.setRequestMethod("GET");
                        c.setDoOutput(true);
                        c.connect();

                                String PATH = 
Environment.getExternalStorageDirectory()+ "/
download/";
                                Log.v("log_tag", "PATH: " + PATH);
                                File file = new File(PATH);
                                if (!file.exists()) {
                                        file.mkdirs();
                                }
                                File outputFile = new File(file, fileName);
                                FileOutputStream fos = new 
FileOutputStream(outputFile);

                                InputStream is = c.getInputStream();

                                byte[] buffer = new byte[1024];
                                int len1 = 0;
                                while ((len1 = is.read(buffer)) != -1) {
                                        fos.write(buffer, 0, len1);
                                }
                                fos.close();
                                is.close();

                    } catch (IOException e) {
                        Log.d("log_tag", "Error: " + e);
                    }
                    Log.v("log_tag", "Check: ");
         }

I have added user permission in manifest.xml as
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
And i check for SD card status in
Environment.getExternalStorageState() it gives as "removed"
But i added 1GB size for my sd card when creating the AVD.
I'm new to android and resolving this is really important to me
Pleas anyone can help me

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to