Click here to Skip to main content
15,881,872 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi i wanna take some pictures with my app the after user install that in first run those files copy to internal storage but i don't know where should i put my pictures i try to put it into Asset folder but now i can't copy that into internal storage.
i try this code:

Java
class bgTask extends AsyncTask
        {

            @Override
            protected Object doInBackground(Object[] params) {
                String src="file:///android_asset/images";
                String dst=Environment.getExternalStorageDirectory().toString() +"/123/";
                File s=new File(src);
                File d=new File(dst);
                try {
                    FileUtils.copyDirectory(s, d);
                } catch (IOException e) {
                    e.printStackTrace();
                }

                return null;
            }
        }
new bgTask().execute();

but i got this error:

05-17 11:26:55.455 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ java.io.FileNotFoundException: Source 'file:/android_asset/images' does not exist
05-17 11:26:55.460 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:1368)
05-17 11:26:55.460 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:1261)
05-17 11:26:55.460 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:1230)
05-17 11:26:55.460 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at mohammadi.behnam.telegramsticker.MainActivity$1bgTask.doInBackground(MainActivity.java:60)
05-17 11:26:55.460 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:287)
05-17 11:26:55.460 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:234)
05-17 11:26:55.460 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
05-17 11:26:55.460 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
05-17 11:26:55.465 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
05-17 11:26:55.465 16182-16250/mohammadi.behnam.telegramsticker W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
Posted
Updated 16-May-15 21:08pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900