有人能告訴我什麼是我應該添加到我當前的代碼播放視頻的具體代碼?如何在點擊「顯示視頻」按鈕後播放視頻?
public class ViewVideo extends Activity {
private String filename;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
filename = extras.getString("videoPath");
VideoView viewVideo = new VideoView(this);
setContentView(viewVideo);
viewVideo.setVideoPath(filename);
viewVideo.setMediaController(new MediaController(this));
viewVideo.requestFocus();
viewVideo.start();
}
}
,所以我應該把這個代碼進入ViewVideo.class? – misery 2011-05-16 03:09:26
你可以通過傳遞這些參數來調用這個方法:path,filename和autoplay ..你可以在onCreate(Bundle savedInstanceState)之後放置這個方法.. – CMA 2011-05-16 07:02:49