Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android:video as splash screen

I want to play the video as splash screen.I have implement the play video but it show the default control like play,pause and seek etc.I want to remove the so that the after video finish I need to call the new activity.

 MediaController mc = new MediaController(this);
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    video.setMediaController(mc);
    video.setVideoURI(uri);
    video.setOnCompletionListener(this);
    video.setOnTouchListener(new OnTouchListener() {

            public boolean onTouch(View arg0, MotionEvent arg1) {
                Toast.makeText(getApplicationContext(), "ontouch",Toast.LENGTH_LONG).show();
                return true;
            }
        }) ;

and the main.xml

Thank in advance.

like image 446
Sameer Z. Avatar asked Mar 29 '11 13:03

Sameer Z.


People also ask

How do you animate a splash screen on Android?

Go to app > java > first package name > right-click > New > Activity > Empty Activity and create another activity and named it as SplashScreen. Edit the activity_splash_screen. xml file and add image, text in the splash screen as per the requirement.


2 Answers

The answer was too simple remove the line

 video.setMediaController(mc);

because i did not want to use the control.

Thank you

like image 125
Sameer Z. Avatar answered Oct 16 '22 11:10

Sameer Z.


Disable the touchable property in the layout.xml file:

<VideoView 
android:layout_width="fill_parent" 
android:id="@+id/videoView1" 
android:layout_height="wrap_content" 
android:clickable="false"/>

Hope that helps you

Now there is a Method called

setMediaController(MediaController mCtrl)

http://d.android.com/reference/android/widget/VideoView.html#setMediaController%28android.widget.MediaController%29

You can call this method and pass the argument as MediaController.hide()

Here is a Sample Code:

MediaController controller=MediaController(Context);
controller.hide();
VideoView videoView= (VideoView) findViewById(R.id.videoView1);
videoView.setMediaController(controller);
//try passing null here as well
like image 45
Anoop Chandrika HarisudhanNair Avatar answered Oct 16 '22 10:10

Anoop Chandrika HarisudhanNair