Copy the APK resource file to the SD card.
[Html]/*
* Copy the raw file to the SD card.
**/
Public void copyResToSdcard (String name) {// name is the path specified under the SD card
Field [] raw = R. raw. class. getFields ();
For (Field r: raw ){
Try {
// System. out. println ("R. raw." + r. getName ());
Int id = getResources (). getIdentifier (r. getName (), "raw", getPackageName ());
If (! R. getName (). equals ("allapps ")){
String path = name + "/" + r. getName () + ". png ";
BufferedOutputStream bufEcrivain = new BufferedOutputStream (new FileOutputStream (new File (path ))));
BufferedInputStream VideoReader = new BufferedInputStream (getResources (). openRawResource (id ));
Byte [] buff = new byte [20*1024];
Int len;
While (len = VideoReader. read (buff)> 0 ){
BufEcrivain. write (buff, 0, len );
}
BufEcrivain. flush ();
BufEcrivain. close ();
VideoReader. close ();
}
} Catch (Exception e ){
E. printStackTrace ();
}
}
}
From agods-footprint