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方法,使用也非常简单。
分享到:
相关推荐
Android学习笔记-Activity篇 Contents Android学习笔记-Activity篇 1 一、activity创建: 1 二、在manifest.xml中声明activity: 1 三、启动activity 1 3.1 启动不带返回结果的Activity 1 3.2 启动带有返回结果的...
android学习笔记-clip.pdf
android学习笔记--clip.pdf
android学习笔记--clip参照.pdf
http://blog.csdn.net/loveqRc/article/details/54169666 Android学习笔记--Gson笔记
Android学习笔记-SQLite介绍-以及使用Sqlite-进行数据库的创建-完成数据.pdf
Android学习笔记--通过wifi向服务器端发送数据
Python学习笔记--皮大庆,非常适合零基础入门。对应英文版本《How to think like a computer scientist》
黑马程序员之android学习笔记--用户界面 View(一).docx
Android学习笔记-采用ListView实现数据列表显示-以及各种适配器使用-和如何写.pdf
Android学习笔记-service[参考].pdf
android 的学习笔记 菜单时android的重要用户接口之一
python爬虫学习笔记-scrapy框架(1) python scrapy 爬虫 python爬虫学习笔记-scrapy框架(1) python scrapy 爬虫 python爬虫学习笔记-scrapy框架(1) python scrapy 爬虫 python爬虫学习笔记-scrapy框架(1) python ...
android的binder机制提供一种进程间通信的方法,使不同一个进程可以以类似远程过程调用的形式调用另一个进程所提供的功能。binder机制在Java环境和C/C++环境都有提供。
Android开发笔记---ListView
Android自学笔记-11-listview简单例子
LaTex教程--latex排版学习笔记---入门提高.pdf
JDBC学习笔记--JDBC学习笔记JDBC学习笔记--JDBC学习笔记JDBC学习笔记--JDBC学习笔记JDBC学习笔记--JDBC学习笔记
zookeeper云的学习笔记-云的学习笔记系统-云的学习笔记系统源码-云的学习笔记管理系统-云的学习笔记管理系统java代码-云的学习笔记系统设计与实现-基于ssm的云的学习笔记系统-基于Web的云的学习笔记系统设计与实现-...