What is wrong on this code ?
I've a Raw file in my project (mp4 videofile),
when i do this, and then i retreive file from SDcard file are not identical so video can not be load :(
Do you have another way to automaticly copy a raw file to sdcard ?
Thanks
String FICHIER_BLOW = "blowvid4.mp4";
File f=new File(Environment.getExternalStorageDirectory(), FICHIER_BLOW);
try {
if (f.createNewFile()){
FileWriter ecrivain = new FileWriter(f);
BufferedWriter bufEcrivain = new BufferedWriter(ecrivain);
BufferedInputStream VideoReader = new BufferedInputStream(getResources().openRawResource(R.raw.blow));
while( VideoReader.available() > 0 ){
bufEcrivain.write(VideoReader.read());
}
bufEcrivain.close();
VideoView videoView = (VideoView) findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
video =Uri.fromFile(f);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}