Android应用程序显示欢迎画面并开机自启动
来源:互联网 发布:佛山正大数据恢复中心 编辑:程序博客网 时间:2024/05/17 06:33
http://www.cnblogs.com/lcyty/archive/2013/04/02/2996541.html
放到新注册的Activity下,使其首先启动。
Activity的代码如下:
import android.annotation.SuppressLint;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.Window;//欢迎界面@SuppressLint("HandlerLeak")public class WelcomeActivity extends Activity{ private static final String S = "MainActivity"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏 setContentView(R.layout.welcome); //启动线程 Thread mt = new Thread(mThread); mt.start(); } private Handler mHandler = new Handler(){ @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); if((String)msg.obj == S) { //跳转 Intent intent = new Intent(); intent.setClass(WelcomeActivity.this, MainActivity.class); WelcomeActivity.this.startActivity(intent); finish(); } } }; Runnable mThread = new Runnable() { @Override public void run() { // TODO Auto-generated method stub Message msg = mHandler.obtainMessage(); //延时3秒 try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } msg.obj = S; mHandler.sendMessage(msg); } };}
首先使窗口全屏,显示画面,然后打开一个线程,在线程中延时3秒发送一个消息,在消息处理中跳转到Mainctivity并且关闭WelcomeActivity。这样就实现了开机欢迎画面出现3秒的效果。
0 0
- Android应用程序显示欢迎画面并开机自启动
- android 开机自启动应用程序
- android 应用程序实现开机自启动
- Android应用程序的开机自启动
- android实现应用程序的开机自启动
- Android实现应用程序的开机自启动
- android实现应用程序的开机自启动
- android应用程序开机自启动方法
- Android之应用程序监听开机启动自启动应用程序
- 【开机自启动】开机自启动应用程序
- Wince 开机画面/自启动程序
- WinCE应用程序开机自启动
- WinCE开机自启动应用程序
- MFC应用程序开机自启动
- Android应用程序开机开机启动
- Android--一个好玩的应用程序/开机自启动
- Android开发之实现应用程序的开机自启动
- Android 开机启动应用程序
- Java字符串处理函数
- 阶乘
- boot bootcmd bootargs
- BitmapFactory.decodeResource加载图片缩小的原因及解决方法
- 布隆过滤器 序列化与反序列化
- Android应用程序显示欢迎画面并开机自启动
- Kinect for Windows SDK开发入门(五):景深数据处理 下
- 【Leetcode】Path Sum
- 实例阐述浮点数解包运算过程
- 深入理解 jdk 动态代理的实现
- c++模板技术
- 我的第一篇博文
- Cocos2D-x游戏开发之一:场景切换
- MFC (1)CAnimate Control 应用