思想就是利用SharedPreferences进行判断:
[java] view plaincopy- SharedPreferences setting = getSharedPreferences(SHARE_APP_TAG, 0);
- Boolean user_first = setting.getBoolean("FIRST",true);
- if(user_first){//第一次
- setting.edit().putBoolean("FIRST", false).commit();
- Toast.makeText(MainActivity.this, "第一次", Toast.LENGTH_LONG).show();
- }else{
- Toast.makeText(MainActivity.this, "不是第一次", Toast.LENGTH_LONG).show();
- }