Please could anyone help me....

On Thu, Oct 16, 2008 at 11:32 AM, guru <[EMAIL PROTECTED]> wrote:

>
> I needed to download a file and store it in my sdcard.I first save it
> by writing in the output stream(by using openFileOutput) in the
> application package.From here I copy it to my SDCard and its written
> on my SDCard.But when i see my SDCard in the file in the DDMS mode i
> am able to see that file,but in the SDCard i was not able to see that
> file.Please could anyone tell how can this be acheived.
>
>
> heres the code snippet i use.
>
> String fileName = "myFileName";
> File bufferedFile = new File("/sdcard/"+fileName);
> copyFiletoSDCard(downloadingMediaFile,bufferedFile.getAbsolutePath());
>
> private void copyFiletoSDCard(File fromFile, String fileName) {
>                FileInputStream from = null;
>                FileOutputStream to = null;
>                try {
>                        from = context.openFileInput(fromFile.getName());
>                        to = new FileOutputStream(fileName);
>                        byte[] buffer = new byte[4096];
>                        int bytesRead;
>
>                        while ((bytesRead = from.read(buffer)) != -1)
>                                to.write(buffer, 0, bytesRead); // write
>                } catch(IOException ioException){
>                        Log.i(getClass().getName(),"ioException Msg");
>
>  Log.i(getClass().getName(),ioException.getMessage());
>                        ioException.printStackTrace();
>                }finally {
>                        if (from != null)
>                                try {
>                                        from.close();
>                                } catch (IOException e) {
>                                        ;
>                                }
>                        if (to != null)
>                                try {
>                                        to.close();
>                                } catch (IOException e) {
>                                        ;
>                                }
>                }
>
>        }
> >
>

--~--~---------~--~----~------------~-------~--~----~
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