I my application i am going to implement the Progress dialog till its getting loading. . .
The code is like:
copyFileFromAssetsToSDCard("Alone.mp4");
intent = new Intent(this,VideoPlayerController.class);
startActivity(intent);
So how to implement it ??
Thanks.
Code for the function is:
public void copyFileFromAssetsToSDCard(String fileFromAssets){
AssetManager is = this.getAssets();
InputStream fis;
try {
fis = is.open(fileFromAssets);
FileOutputStream fos;
fos = new FileOutputStream(new File(Environment.getExternalStorageDirectory(), fileFromAssets));
byte[] b = new byte[8];
int i;
while ((i = fis.read(b)) != -1) {
fos.write(b, 0, i);
}
fos.flush();
fos.close();
fis.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
You can do like this,
Create an
ArrayList<String> files = new ArrayList<String>();and add all the files that you can to copy to SDCard like the below.Then you can just use this ArrayList object to pass to AsynTask and get it done.