Cannot get value from sharedpreferences

前端 未结 1 1205
隐瞒了意图╮
隐瞒了意图╮ 2021-01-27 02:30

I would like to load the value of Name from the sharedpreference that is defined below, but I cant. How can I extract the value of Name and toast it or ideally put it in the tex

相关标签:
1条回答
  • 2021-01-27 03:03

    You should either use getDefaultSharedPreferences() or getSharedPreferences("myCustomSharedPrefs",...) in both places.

    That way you create (AFAIK) different shared preferences and fail to read the data you write into the other.

    0 讨论(0)
提交回复
热议问题