引导页之倒计时跳转 <并记录状态>
来源:互联网 发布:网上体彩软件下载 编辑:程序博客网 时间:2024/06/05 02:12
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/text_1" /></LinearLayout>
代码实现
public class hone extends Activity { private TextView textView; int time=3; Handler handler=new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); if (time==0){ Intent intent = new Intent(MainActivity.this, HomeActivity.class); startActivity(intent); finish(); }else { textView.setText(time+": 秒跳转"); } } }; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_aaa); textView = (TextView) findViewById(R.id.text_1); //getSharedPreferences 记录状态 SharedPreferences sh = getSharedPreferences("name", MODE_PRIVATE); SharedPreferences.Editor edit = sh.edit(); boolean aTrue = sh.getBoolean("true", false); if (aTrue){ Intent intent = new Intent(MainActivity.this, HomeActivity.class); startActivity(intent); finish(); }else { edit.putBoolean("true",true); edit.commit(); Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { time--; handler.sendEmptyMessage(0); } }, 0, 2000); } }}
阅读全文
0 0
- 引导页之倒计时跳转 <并记录状态>
- 圆形头像和倒计时引导页按钮点击跳转
- splash页面定时跳转,引导页倒计时功能开发
- JQuery-倒计时显示并跳转
- Android实现引导页并滑动跳转到主界面
- 倒计时跳转页
- handler倒计时跳转页
- 【转】js倒计时并实现页面跳转
- angular中页面倒计时自动跳转,并显示出倒计时。
- viewpage设置引导页之最后一页左滑跳转
- 倒计时跳转
- 引导页 三秒跳转 timer计时器
- 欢迎界面跳转到程序主界面之倒计时,线程
- Android 倒计时跳转页面之handler的详细运用
- Sharedperferenced之引导页
- 倒计时跳转页面
- JavaScript 倒计时跳转
- 倒计时自动跳转
- PCI接口开发笔记
- 关于return返回
- linux基础入门之cd命令
- 卷积神经网络学习--卷积和池化
- TCP中的定时器
- 引导页之倒计时跳转 <并记录状态>
- 解析XML数据(dom4j)
- c++空类实例大小不是0原因
- Java语言基础简介(五)
- mysql主从复制
- java 异常处理
- Bagging和Boosting的区别
- dataTable 导出excel 打印
- 程设讨论区妙着集锦