SharedPreferences sharedPreferences = getActivity().getSharedPreferences("config", getActivity().MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); final boolean login = sharedPreferences.getBoolean("login", false); if (login){ Intent intent = new Intent(getActivity(), OtherActivity.class); startActivity(intent); getActivity().finish(); } Handler handler=new Handler(); SharedPreferences sharedPreferences = getActivity().getSharedPreferences("config", getActivity().MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); final boolean login = sharedPreferences.getBoolean("login", false); handler.postDelayed(new Runnable() { @Override public void run() { if (login == false){ editor.putBoolean("login",true); editor.commit(); Intent intent = new Intent(getActivity(), OtherActivity.class); startActivity(intent); getActivity().finish(); } } },3000);
SharedPreferences
最新推荐文章于 2019-06-19 17:08:43 发布