Copying Video file from raw folder to sdcard.

All your problems with Audio, Video and Images.

Copying Video file from raw folder to sdcard.

Postby senthil_prabhu » Fri Nov 26, 2010 2:24 pm

Hi i am new to android can anyone help me to copy a video file which is in raw folder to sd card. I was trying it for couple of days and finally i got a code but in that code only the name is copying but not the video so con any one help me for this. thank you

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import android.app.Activity;
import android.net.Uri;
import android.os.Environment;
import android.widget.MediaController;
import android.widget.VideoView;


public class Download_Act extends Activity {
String FICHIER_BLOW = "blowvid4.mp4";
File f=new File(Environment.getExternalStorageDirectory(), FICHIER_BLOW);{
try {
if (f.createNewFile()){

BufferedOutputStream bufEcrivain = new BufferedOutputStream((new FileOutputStream(f)));
BufferedInputStream VideoReader = new BufferedInputStream(getResources().openRawResource(R.raw.funnyclip));
byte[] buff = new byte[32 * 1024];
int len;
while( (len = VideoReader.read(buff)) > 0 ){
bufEcrivain.write(buff,0,len);
}

bufEcrivain.flush();
bufEcrivain.close();

VideoView videoView = (VideoView) findViewById(R.id.video);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.fromFile(f);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
this is my code please can any one help me.
senthil_prabhu
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun Sep 19, 2010 10:13 am

Top

Re: Copying Video file from raw folder to sdcard.

Postby senthil_prabhu » Sat Nov 27, 2010 7:42 am

Is there any one who knows please help me.........
senthil_prabhu
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun Sep 19, 2010 10:13 am

Re: Copying Video file from raw folder to sdcard.

Postby novice21 » Sat Nov 27, 2010 7:47 am

Hi
I dont know how to copy from raw to sdcard,but it is simple to copy any file from pc to sdcard..

goto to DDMS perspective->File explorer->Sdcard

In the Top of the right corner you will find two Icons Floppy and Mobile icon.

Floppy->To copy a file from Sdcard.
Mobile->To copy a file to Sdcard.

I hope It may useful for you.
novice21
Freshman
Freshman
 
Posts: 9
Joined: Thu Nov 18, 2010 8:33 am

Re: Copying Video file from raw folder to sdcard.

Postby senthil_prabhu » Sat Nov 27, 2010 7:50 am

Thanks for your reply but i know that i need to do it using a code do you know that.
senthil_prabhu
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun Sep 19, 2010 10:13 am

Re: Copying Video file from raw folder to sdcard.

Postby senthil_prabhu » Sat Nov 27, 2010 1:07 pm

thanks i got the code:)........
senthil_prabhu
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun Sep 19, 2010 10:13 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot] and 14 guests