tags:

views:

161

answers:

1

Hi, I am trying to make the videoView to appear in full screen.the code is

   public class ViewVideo extends Activity {
  private String filename;
  private static final int INSERT_ID = Menu.FIRST;
  @Override
  public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        System.gc();
        Intent i = getIntent();
        Bundle extras = i.getExtras();
        filename = extras.getString("videofilename");
        VideoView vv = new VideoView(getApplicationContext());
        setContentView(vv);
        vv.setVideoPath(filename);
        vv.setMediaController(new MediaController(this));
        vv.requestFocus();
        vv.start();

  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      super.onCreateOptionsMenu(menu);
      menu.add(0, INSERT_ID, 0,"FullScreen");

      return true;
  }
  @Override
  public boolean onMenuItemSelected(int featureId, MenuItem item) {
      switch(item.getItemId()) {
      case INSERT_ID:
          createNote();
      }
          return true;

  }
      private void createNote() {

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

      }

}

the video is playing from the sdcard.Only thing is when i click on fullscreen menu button,it show the application is stopped unexpectedly.Please help me out how to get the video to run in full screen.Thanks in advance.

+1  A: 

when you click an menu item. you have to start a New Activity. for that Activity you have to set the theme attribute in the Manifest. set this value that is

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

thats it.

Praveen Chandrasekaran