package com.paad; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.MotionEvent; import android.widget.ImageView; public class Splash extends Activity { /** * The thread to process splash screen events */ private Thread mSplashThread; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Splash screen view // The thread to wait for splash screen events mSplashThread = new Thread(){ @Override public void run(){ try { synchronized(this){ setContentView(R.layout.splash); // Wait given period of time or exit on touch wait(5000); } } catch(InterruptedException ex){ } finish(); // Run next activity Intent intent = new Intent(); intent.setClass(Splash.this, main.class); startActivity(intent); stop(); } }; mSplashThread.start(); } /** * Processes splash screen touch events */ @Override public boolean onTouchEvent(MotionEvent evt) { if(evt.getAction() == MotionEvent.ACTION_DOWN) { synchronized(mSplashThread){ mSplashThread.notifyAll(); } } return true; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)