1 SharedPreferences settings =Activity.getPreferences(Activity.MODE_PRIVATE);

   访问数据的范围为 当前的activity 

 

2 SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);

   访问数据的范围 为 当前app ,类似于全局变量

    

        

相关文章:

  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2021-04-08
  • 2021-04-28
猜你喜欢
  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2021-08-08
  • 2021-05-05
  • 2021-06-21
相关资源
相似解决方案