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(){ @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub switch (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); } }
本文出自 “曾颐楠的播客” 博客,请务必保留此出处http://zengyinan.blog.51cto.com/9524976/1721449