Wednesday 11 July 2012

SplashScreen in android


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
public class SplashScreen extends Activity
 {
     private Thread mSplashThread;   
     public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.splash);       
          final SplashScreen sPlashScreen = this;  
          mSplashThread =  new Thread()
           {       
               public void run()
                {
                    try
                     {
                      synchronized(this)
                       {
                        wait(1000);                    
                       }
                     }
                    catch(InterruptedException ex)
                     {                   
                     }
                    finish();
                    Intent intent = new Intent();
                    intent.setClass(sPlashScreen, OurWishingWellActivity.class);
                    startActivity(intent);                   
                }
           };       
           mSplashThread.start();       
      }       
     public boolean onTouchEvent(MotionEvent evt)
      {
          if(evt.getAction() == MotionEvent.ACTION_DOWN)
           {
               synchronized(mSplashThread)
                {
                    mSplashThread.notifyAll();
                }
           }
          return true;
      }   
 }

No comments:

Post a Comment