Here is my code snippet:
InputStream is = getContext().getResources().getAssets().open
("temp.zip");
OutputStream os = new FileOutputStream("/sdcard/downloads");
byte[] b = new byte[1024];
int length;
while ((length = is.read(b))>0) { os.write(b,0,length);}
is.close();
os.close();
I appreciate your help. Thanks.
On Sep 4, 4:51 pm, androiduser mobile <[email protected]>
wrote:
> Hi Mark,
>
> Thanks for the immediate response. I tried using this approach and I
> have a zip file in assets folder, which is throwing
> "FileNotFoundException". Can you please suggest how to solve this
> exception.
>
> Thanks.
>
> On Sep 4, 4:38 pm, "Mark Murphy" <[email protected]> wrote:
>
>
>
> > > Is there any way to copy the files from "assets" folder of the project
> > > to emulator SD card using android application.
>
> > An application can copy its own asset wherever using streams:
>
> >http://exampledepot.com/egs/java.io/CopyFile.html
>
> > (instead of InputStream in = new FileInputStream(src), you would use
> > getResources().getAssets().open() to get the InputStream)
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > Android App Developer Books:http://commonsware.com/books.html- Hide quoted
> > text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---