又是关于Android的问题
publicclassPlayVideoextendsActivity{privateVideoViewvideoView;privateMediaControllerm...
public class PlayVideo extends Activity {
private VideoView videoView;
private MediaController mc ;
private String path ;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.other);
videoView = (VideoView) this.findViewById(R.id.videoView);
//path ="file:///sdcard/Movies/1.3gp";
//videoView.setVideoURI(Uri.parse(path));
path="E://movie.mp4";
mc = new MediaController(this);
videoView.setMediaController(mc);
videoView.setVideoPath(path);
videoView.setOnCompletionListener(new OnCompletionListener(){
public void onCompletion(MediaPlayer arg0) {
finish();
}
});
videoView.requestFocus();
videoView.start();
}
}
public class VideoPlayAcitvity extends Activity {
private Button button01;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button01 = (Button) findViewById(R.id.button01);
button01.setOnClickListener(new buttonListener());
}
class buttonListener implements OnClickListener {
public void onClick(View v) {
Intent intent = new Intent(VideoPlayAcitvity.this, PlayVideo.class);
VideoPlayAcitvity.this.startActivity(intent);
}
}
}
在上面的Andriod代码中,我在api当中查到这个方法,这个方法具体怎么用。我实在弄不明白 展开
private VideoView videoView;
private MediaController mc ;
private String path ;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.other);
videoView = (VideoView) this.findViewById(R.id.videoView);
//path ="file:///sdcard/Movies/1.3gp";
//videoView.setVideoURI(Uri.parse(path));
path="E://movie.mp4";
mc = new MediaController(this);
videoView.setMediaController(mc);
videoView.setVideoPath(path);
videoView.setOnCompletionListener(new OnCompletionListener(){
public void onCompletion(MediaPlayer arg0) {
finish();
}
});
videoView.requestFocus();
videoView.start();
}
}
public class VideoPlayAcitvity extends Activity {
private Button button01;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button01 = (Button) findViewById(R.id.button01);
button01.setOnClickListener(new buttonListener());
}
class buttonListener implements OnClickListener {
public void onClick(View v) {
Intent intent = new Intent(VideoPlayAcitvity.this, PlayVideo.class);
VideoPlayAcitvity.this.startActivity(intent);
}
}
}
在上面的Andriod代码中,我在api当中查到这个方法,这个方法具体怎么用。我实在弄不明白 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询