---
title: "Android学习笔记----Android简单有效的闪屏制作"
author: "BarryWei"
date: "2010-01-08T16:04:46Z"
tags: []
categories: ["移动开发"]
slug: "android-android"
draft: false
lastmod: "2010-01-08T16:04:46Z"
id: 565936
url: "https://barrywei.iteye.com/blog/565936"
---

```
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        new Handler().postDelayed(new Runnable(){
			public void run() {
                Intent mainIntent = new Intent(SplashActivity.this,MainActivity.class); 
                SplashActivity.this.startActivity(mainIntent); 
                SplashActivity.this.finish(); 
			}}, 10000);
    }
```

 

在API中对于Handler的postDelayed方法描述如下：

Android API 写道

final boolean postDelayed(Runnable r, long delayMillis) Causes the Runnable r to be added to the message queue, to be run after the specified amount of time elapses.

 

将Runnable对象r在经过deleyMillis的时间后加入到消息队列，也就是讲过多久以后做什么事情就可以了。看起来很简单，有点类似于HTML里面的setTimeout和setInternal方法，使用也非常简单。