List of usage examples for android.widget VideoView setKeepScreenOn
public void setKeepScreenOn(boolean keepScreenOn)
From source file:Main.java
/** * Play video file from res folder.//from w w w .ja v a2 s . c om * Then call video.start(); * @param activity - current Activity * @param videoViewId R.id.introVideo * @param videoResourceId R.raw.intro - res/raw/intro.mp4 * @return VideoView */ public static VideoView playVideo(Activity activity, int videoViewId, int videoResourceId, MediaPlayer.OnCompletionListener listener) { activity.getWindow().setFormat(PixelFormat.TRANSLUCENT); VideoView view = (VideoView) activity.findViewById(videoViewId); view.setVideoURI( Uri.parse("android.resource://" + activity.getPackageName() + File.separator + videoResourceId)); view.setKeepScreenOn(true); view.setMediaController(null); view.setOnCompletionListener(listener); view.requestFocus(); return view; }