I am downloading multiple videos and showing its progress in list items. I am saving each 5% download information in my sdcard files so that if user clear data of the app still there should be enough information to show pending progress. I am using below code to show progress:
But after i put 5 or 6 videos in download it hangs up whole ui and after some time crashed the app. In my log cat it only shows
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ java.io.IOException: open failed: EMFILE (Too many open files)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at java.io.File.createNewFile(File.java:941)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at com.intersoft.youngcutsmovies.AppActivity$writeTo.doInBackground(AppActivity.java:162)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at com.intersoft.youngcutsmovies.AppActivity$writeTo.doInBackground(AppActivity.java:123)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:288)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at java.lang.Thread.run(Thread.java:818)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ Caused by: android.system.ErrnoException: open failed: EMFILE (Too many open files)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at libcore.io.Posix.open(Native Method)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ at java.io.File.createNewFile(File.java:934)
03-18 10:19:42.651 25120-25626/toteflix.com W/System.err﹕ ... 8 more