2

hai how set video in full screen now i am attach my screen shot....

alt text

alt text

<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="videothumb.videothumb"
  android:versionCode="1"
  android:versionName="1.0">
 <application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".videothumb" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

   <activity android:name="ViewVideo" android:label="@string/app_name"    
      android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
   <intent-filter><action android:name="android.intent.action.VIEW"></action>
   <category android:name="android.intent.category.DEFAULT"></category>
   </intent-filter>
   </activity>

   </application>
   <uses-sdk android:minSdkVersion="8" />
   <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS">
   </uses-permission>
   </manifest> 

ViewVideo.java

package videothumb.videothumb;


import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.GridView;
import android.widget.MediaController;
import android.widget.VideoView;

public class ViewVideo extends Activity {
  private String filename;
  private VideoView Video;
  @Override
  public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.main1);
        Video=(VideoView)findViewById(R.id.VideoView01);
        System.gc();
        Intent i = getIntent();
        Bundle extras = i.getExtras();
        filename = extras.getString("videofilename");
        Video.setVideoPath(filename);
        Video.setMediaController(new MediaController(this));
        Video.requestFocus();
        Video.start();
    }

  } `

xml coding:

<?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/VideoView01" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent">
</VideoView>
</LinearLayout>
RBJ
  • 951
  • 8
  • 22
  • 34
  • check this link: http://stackoverflow.com/questions/2868047/fullscreen-activity-in-android – Praveen Nov 23 '10 at 07:15
  • i try this coding..till same problem check my mainfest. what mistake i made......help me.... – RBJ Nov 23 '10 at 07:52

4 Answers4

3

Have you tried this:

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

in your class that contains mediaplayer code.

and in your xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent" >
   <VideoView android:id="@+id/myvideoview"
             android:layout_width="fill_parent"
             android:layout_alignParentRight="true"
             android:layout_alignParentLeft="true"
             android:layout_alignParentTop="true"
             android:layout_alignParentBottom="true"
             android:layout_height="fill_parent">
    </VideoView>
 </RelativeLayout>

I hope this will help you.

Piyush
  • 2,589
  • 6
  • 38
  • 77
  • yes i tried this method. now i am post xml,java source code and manifest coding also please check my coding what mistake i made for this coding.....waiting for your reply..... – RBJ Nov 23 '10 at 10:35
  • And one more thing is you use either theme in menifest file or by programmatically (requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); ). you should not use both. – Piyush Nov 23 '10 at 11:12
  • sorry, you have put that lines in your class. now just remove theme from your menifest file. than do clean-build and try to run you code. – Piyush Nov 23 '10 at 11:26
  • 1. i have put that lines in my class..and change frame layout...removed theme in manifest.....after run my project same screen will be display – RBJ Nov 23 '10 at 11:31
  • you have use two class right? so what are you doing in your first class? – Piyush Nov 23 '10 at 11:42
3

No need of code to play video in full screen mode

Apply the following layout format over the xml containing the videoview it will for sure will play the video in full screen mode. as it is running mine :) Hope it helps

 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent" >
   <VideoView android:id="@+id/myvideoview"
             android:layout_width="fill_parent"
             android:layout_alignParentRight="true"
             android:layout_alignParentLeft="true"
             android:layout_alignParentTop="true"
             android:layout_alignParentBottom="true"
             android:layout_height="fill_parent">
    </VideoView>
 </RelativeLayout>
Rohit Sharma
  • 13,787
  • 8
  • 57
  • 72
0

my java file:

public class VideoViewDemo extends Activity {

VideoView mVideoView;
MediaController mc;
@Override
public void onCreate(Bundle icicle) {
   super.onCreate(icicle);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);//if you want.
    File video = new File("your file path");
    mVideoView = (VideoView) findViewById(R.id.surface);
    mc = new MediaController(this);
    mVideoView.setMediaController(mc);
    mc.setAnchorView(mVideoView);
    mVideoView.setMediaController(mc);
    mVideoView.setVideoPath(video.getAbsolutePath());
    mVideoView.requestFocus();
    mVideoView.start();

}                                                                                        

my xml layout:

and my Menifest file:

Piyush
  • 2,589
  • 6
  • 38
  • 77
  • now i am expect landscape format. your coding working fine...but that type still i am trying...if u got tell me..... – RBJ Nov 23 '10 at 13:00
  • i have check your code in my eclipse and it doesnt show title bar or status bar i have just remove system.gc(); from your code. – Piyush Nov 23 '10 at 13:04
0

By the way, in your manifest, at this line <activity android:name="ViewVideo",you forgot to put a dot(.) before the "ViewVideo". It should be ".ViewVideo"

Codes12
  • 376
  • 6
  • 21