Android程序启动画面

public class SplashScreenTest extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    /** set time to splash out */
    final int welcomeScreenDisplay = 3000;
    new Handler().postDelayed(new Runnable(){
       @Override
       public void run() {
           Intent mainIntent = new Intent(SplashScreenTest.this,MainActivity.class);
           startActivity(mainIntent);
           finish();
       }
      }, welcomeScreenDisplay);
    }
}
public class MainActivity extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView textView = new TextView(this);
    textView.setText(“Main Activity”);
    setContentView(textView);
  }
}

svn checkout https://myandroidcode.googlecode.com/svn/trunk/SplashScreenTest

源代码
http://code.google.com/p/myandroidcode/source/browse/trunk/SplashScreenTest
 
 

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注