Media
Step #2: Create the Stub Helpcast Activity
Now, we need to add an activity that will use the VideoView widget to
display our video clip.
First, add the following layout as Patchy/res/layout/helpcast.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<VideoView
android:id="@+id/video"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
Then, create Patchy/src/apt/tutorial/two/HelpCast.java with the following
code:
package apt.tutorial.two;
import android.app.Activity;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.MediaController;
import android.widget.VideoView;
import java.io.File;
public class HelpCast extends Activity {
private VideoView video;
private MediaController ctlr;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
setContentView(R.layout.helpcast);
File clip=new File(Environment.getExternalStorageDirectory(),
"helpcast.mp4");
if (clip.exists()) {
video=(VideoView)findViewById(R.id.video);