import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class MediacontrollerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView vv = (VideoView)findViewById(R.id.videoView1);
MediaController mc = new MediaController(this);
mc.setAnchorView(vv);
// is used for video view.
vv.setMediaController(mc);
vv.setVideoPath("/sdcard/vi.3gp");
// placed a 3gp format file in sd card .. for this click on File Explorer n place a video in mnt folder..
vv.requestFocus();
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<VideoView
android:id="@+id/videoView1"
android:layout_width="match_parent"
android:layout_height="347dp" />
</LinearLayout>
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class MediacontrollerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView vv = (VideoView)findViewById(R.id.videoView1);
MediaController mc = new MediaController(this);
mc.setAnchorView(vv);
// is used for video view.
vv.setMediaController(mc);
vv.setVideoPath("/sdcard/vi.3gp");
// placed a 3gp format file in sd card .. for this click on File Explorer n place a video in mnt folder..
vv.requestFocus();
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<VideoView
android:id="@+id/videoView1"
android:layout_width="match_parent"
android:layout_height="347dp" />
</LinearLayout>
No comments:
Post a Comment