Rev 2 | 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.graphics.drawable.AnimationDrawable;import android.os.Bundle;import android.view.Window;import android.widget.ImageView;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;AnimationDrawable rocketAnimation;@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);ImageView rocketImage = (ImageView) findViewById(R.id.imageView4);rocketImage.setBackgroundResource(R.drawable.animationsplash);rocketAnimation = (AnimationDrawable) rocketImage.getBackground();rocketAnimation.start();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);}}