一,设置欢迎页面监听,
在结束处设置判断进入主页// 1.如果有进过引导页面,就不用再进直接去主页面.
// 2.如果没有,就先进入主页面,再在引导页面中进入主页面.
//缓存数据(SplashActivity.this,"start_main") 当前页面,"start_main"是KEY
boolean istartmain= CacheUtils.getBoolean(SplashActivity.this, START_MAIN);工具类:
public class CacheUtils { public static boolean getBoolean(Context context , String key) { SharedPreferences sp = context.getSharedPreferences("nbnb",Context.MODE_PRIVATE); return sp.getBoolean(key,false); } }
if (istartmain){ //Intent intent =new Intent(MainActivity.class); // startActivity(intent); }else { Intent intent =new Intent(context,GuideActivity.class); startActivity(intent);
注:
出错1
Intent intent =new Intent(context,GuideActivity.class);
context改为当前Activity.this
轻量级缓存
SharedPreferences(后面编辑.....)