getSharedPreferences parameters MODE_PRIVATE: Specifies that the data can only be read SharedPreferences this application, write,
This parameter, in the Activity inside, read no problem. However, the use of this parameter in Service, read and write is safe and reliable? "This application" should refer to the Activity or the folder it? The latter lot of class, can be safely read and write? Originally wanted to use the other two parameters MODE_WORLD_WRITEABLE and MODE_WORLD_READABLE, but eclipse prompted these two constants outdated
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
MODE_PRIVATE specify the SharedPreferences can be read in this application or all applications shareUserId's. Activity is not limited to a certain or Service.
Developers writing their own to ensure the safety, if two write operations simultaneously, the result is always behind the write operation.
Reply:
Thank tantahe. For example, an application contains three activity and a service, these three class can read and write the file, right?
Reply:
All OK
Reply:
Can bar, activity and service-independent
No comments:
Post a Comment