AutorÃa | Ultima modificación | Ver Log |
package com.cesams.twogetskills.activity;import android.app.Activity;import android.content.Intent;import android.content.pm.ActivityInfo;import android.os.Bundle;import android.view.Window;import com.cesams.twogetskills.R;import java.util.Timer;import java.util.TimerTask;public class SplashActivity extends Activity {// Set the duration of the splash screenprivate static final long SPLASH_SCREEN_DELAY = 3500;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);// Set portrait orientationsetRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);// Hide title barrequestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(R.layout.activity_splash);TimerTask task = new TimerTask() {@Overridepublic void run() {// Start the next activityIntent mainIntent = new Intent().setClass(SplashActivity.this, MainActivity.class);startActivity(mainIntent);// Close the activity so the user won't able to go back this// activity pressing Back buttonfinish();}};// Simulate a long loading process on application startup.Timer timer = new Timer();timer.schedule(task, SPLASH_SCREEN_DELAY);}}