//main主页面
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.example.lianxiyuekao.R;
public class MainActivity extends AppCompatActivity {
private TextView mtime;
private int time=5;
private Handler handler=new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
time--;
if (time<=0){
Intent intent = new Intent(MainActivity.this, Main2Activity.class);
startActivity(intent);
finish();
}else{
mtime.setText(time+\"S\");
handler.sendEmptyMessageDelayed(1,1000);
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mtime = (TextView) findViewById(R.id.mtime);
handler.sendEmptyMessageDelayed(1,1000);
}
}
//mian布局
<? version=\"1.0\" encoding=\"utf-8\"?>继续阅读与本文标签相同的文章
上一篇 :
CDN价格下调25% 阿里云再次冲击国内最低价
下一篇 :
Adobe 全力投入 iPad版PS 开发
-
基于宜搭的“企业报销流程”实践案例
2026-05-18栏目: 教程
-
计算的旋律—阿里云视觉语言的探索
2026-05-18栏目: 教程
-
数据库实例性能调优利器-Performance Insights最佳实践
2026-05-18栏目: 教程
-
[集合]Collection源码解析(1)
2026-05-18栏目: 教程
-
300+道面试题&最全面试资料,你值得拥有! | Android面试宝典
2026-05-18栏目: 教程
