2013-07-04 191 views
2

所以我在我的主要活動中有這行代碼。 ortogl.mp4文件是我的SD卡的根文件夾,我有一個索尼愛立信與Android 2.1。 該應用程序安裝和控制檯說錯誤1.0,而手機顯示佈局,但不是視頻(它說無法播放該文件)。 提示?視頻播放器應用程序

VideoView v = (VideoView) findViewById(R.id.videoView1); 
    v.setVideoPath(getString(R.string._sdcard_ortodgl_3gp)); 
    v.setMediaController(new MediaController(this)); 
    v.start(); 
    v.requestFocus(); 

回答

0

這就是我如何解決它

File clip = new File(Environment.getExternalStorageDirectory(),"ortodgl.mp4"); 

    VideoView v = (VideoView) findViewById(R.id.videoView1); 
    v.setVideoPath(clip.getAbsolutePath()); 
    v.setMediaController(new MediaController(this)); 
    v.start(); 
    v.requestFocus();