Find your content:

Search form

You are here

getPreference vs getSharedPreference android

 
Share

getReference

Will open or create a preference file with out giving a name specifically. By default preference file name will be the current Activity name. if some one knows this, any once can access getPreference() file using that activity name.

getSharedPreferences

getSharedPreferences("name",0) - will open or create a preference file with the given name. If you want to create a preference file with a specific name then use this function. If you want multiple preference files for you activity, then also you can use this function.

Note: preferences file will be with .xml extension stored in data/data/preferences folder.

My Block Status

My Block Content