What's the difference between getDefaultSharedPreferences() and getPreferences()?

前端 未结 4 1935
挽巷
挽巷 2020-12-09 18:54

I\'m currently taking the \"Developing Android Apps\" Udacity course. In the \"Lesson 3: New Activities and Intents > Use SharedPreferences\" segment, the instructor asked

4条回答
  •  不思量自难忘°
    2020-12-09 19:32

    One of the major differences: getPreferences () returns a file only related to the activity it is opened from. While getDefaultSharedPreferences () returns the application's global preferences. Learned that the hard way yesterday.

提交回复
热议问题