本文共 1046 字,大约阅读时间需要 3 分钟。
package com.zyn.hahaha;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.app.Activity;import android.content.Intent;import android.view.Menu;import android.view.View;import android.view.Window;public class MainActivity extends Activity {private static final int ENTER=0;private Handler handler = new Handler(){@Overridepublic void handleMessage(Message msg) {// TODO Auto-generated method stubswitch (msg.what) {case ENTER:Intent intent = new Intent(MainActivity.this,ShowActivity.class); startActivity(intent);break;default:break;}super.handleMessage(msg);} }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); enter(); } //停留5s跳转页面private void enter() { Message message = new Message(); message.what = ENTER; //延迟发送 handler.sendMessageDelayed(message,5000);}}
转载于:https://blog.51cto.com/zengyinan/1721449