2016-05-30 10 views
1

私はAndroidプロジェクトを作成します - アプリケーション...
私はビデオを保存することができますし、その後アプリケーションで使用しますか?Androidプロジェクト - どこで動画を保存できますか?

私のアプリでビデオを再生します。

+0

はあなたのAPKでビデオファイルをバンドルしたいですか動的にダウンロードしてデバイスに保存することはできますか? – Egor

+0

resフォルダのraw insideのようなフォルダを作成し、それにアクセスできます.R.raw.video_name –

答えて

0

次のコードを使用することができますディレクトリを作成するには、次の

File dir = new File("path/to/your/directory"); 
try{ 
if(dir.mkdir()) { 
    System.out.println("Directory created"); 
} else { 
System.out.println("Directory is not created"); 
} 
    catch(Exception e){ 
    e.printStackTrace(); 
} 

をそして、あなたのディレクトリパス与えることによって、動画を再生するには、これを使用し

videoView = (VideoView) findViewById(R.id.videoView); 

    Uri video =    Uri.parse("http://www.servername.com/projects/projectname/videos/1361439400.mp4" ); 
    videoView.setVideoURI(video); 
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { 
    @Override  
    public void onPrepared(MediaPlayer mp) { 
    mp.setLooping(true); 
    videoView.start(); 
    } 
    }); 
関連する問題