【安卓】安卓App开发思路 一步一个脚印(一)欢迎界面

来源:互联网 发布:感染hiv知乎 编辑:程序博客网 时间:2024/05/21 14:55

一.欢迎界面

功能点描述:
       1 应用的第一个界面
       2 3秒之后自动关闭
                 第一次使用的时候就跳转到新手引导,  不是第一次使用就跳转到主页面
       3 不能返回,禁止返回键

实现采用  Handler postDelayed(new Runnable(){},3000); 一般为3秒钟自动跳过,具体得看app需求

根据 sharedPreferences 拿到数值 为空这初始化  get+类型("参数名字",初始值) ,

设置值为 

Editor editor=sharePreferences.edit();

editor.put+类型("参数名字",设置值) ;

editor.commit();

SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);boolean isfirst = sharedPreferences.getBoolean("isFirst",true);if(isfirst){//是第一次    SharedPreferences.Editor editor = sharedPreferences.edit();    editor.putBoolean("isFirst",false);//设置为不是第一次    editor.commit();    startActivity(new Intent(SplashActivity.this,GuideActivity.class));}else{//不是第一次    startActivity(new Intent(SplashActivity.this,MainActivity.class));}


重点 实现不白屏幕

待续。。






     

0 0