I am doing the Android Programming Tutorial on Splash Screens where you show a picture or text for 5 Seconds than it goes to the Main Application. My Question is..Instead of
Here is the code for adding video. In case you need to add controls on video like pause or seek etc. you can add them with:
vv.setMediaController(new MediaController(this));
Rest of the code:
VideoView vv;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
vv=(VideoView)findViewById(R.id.videoView);
Uri path=Uri.parse("android:resource://"+getPackageName()+"/"+R.raw.hello);
vv.setVideoURI(path);
vv.setMediaController(new MediaController(this));
vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
{
@Override
public void onCompletion(MediaPlayer mp) {
Intent in=new Intent(splash.this,MainActivity.class);
startActivity(in);
finish();
}
});
vv.start();