播放视频
public class VideoScreen extends Activity { public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.videoscreen); Uri raw_uri=Uri.parse("android.resource://com.binary/"+R.raw.myvideo); VideoView videoView=(VideoView)findViewById(R.id.demoVideo); videoView.setVideoURI(raw_uri); videoView.setMediaController(new MediaController(this)); videoView.setOnCompletionListener(videoOverListener); videoView.start(); videoView.requestFocus(); } }
<?xml version="1.0" encoding="utf-8"?><framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"><videoview android:id="@+id/demoVideo" android:layout_width="wrap_content" android:layout_height="wrap_content"></videoview></framelayout>