// Sample: copy myfile.mp4 from 'assets' to internal /data/data/... folder
FileOutputStream outputStream = context.openFileOutput("myfile.mp4", Context.MODE_WORLD_READABLE);
InputStream inputStream = context.getAssets().open("myfile.mp4");
// Copy data
byte[] buffer = new byte[8192];
int length;
while ( (length=inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, length);
}
// Close the streams
inputStream.close();
outputStream.flush();
outputStream.close();
FileOutputStream outputStream = context.openFileOutput("myfile.mp4", Context.MODE_WORLD_READABLE);
InputStream inputStream = context.getAssets().open("myfile.mp4");
// Copy data
byte[] buffer = new byte[8192];
int length;
while ( (length=inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, length);
}
// Close the streams
inputStream.close();
outputStream.flush();
outputStream.close();
File file = context.getFileStreamPath(FileName);
if (file.exists()) {
// Set to Readable and MODE_WORLD_READABLE
file.setReadable(true, false);
}