判断app是否是第一次进入
2016-04-23 17:44
477 查看
以前做的一个算是小项目的里面就有一个这样的设置,现在写也写不出来,还是把这个记录下来吧。
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); preferences = getSharedPreferences("count",MODE_WORLD_READABLE); int count = preferences.getInt("count", 0); //判断程序与第几次运行,如果是第一次运行则跳转到引导页面 if (count != 0) { Intent intent = new Intent(); intent.setClass(getApplicationContext(),LaunchGuideViewActivity.class); startActivity(intent); this.finish(); } Editor editor = preferences.edit(); //存入数据 editor.putInt("count", ++count); //提交修改 editor.commit();
相关文章推荐
- Android百度地图开发(二):显示地图界面
- Android系统自带样式 @android:style
- Android学习(40) -- 自定义控件(4)广告轮播(ViewPager)
- Android SensorManager分析
- 搭建Android底层开发环境
- Android自定义最简单的dialog
- zoj Apples and Ideas (水)
- Android驱动开发前的准备
- Android自定义控件之继承ViewGroup创建新容器(四)
- Android百度地图开发(一):地图下载与配置
- 微信学习_02_开发模式接入
- android 常用color代码
- Android自定义View实战-100行带你写出SwitchButton
- Swift UILable
- Android Services 创建一个Bound服务
- 全局侧滑
- 直接拿来用!最火的Android开源项目(完结篇)
- Android-Intent详解
- Android mvp的简单使用和实现
- Android-自定义PopupWindow