The difference between the two methods is:
1. Apply does not return a value and a commit returns a Boolean indicating whether the change was committed successfully
2. Apply is to commit the modified data atoms to memory, and then asynchronously commit to the hardware disk, and commit is synchronous commit to the hardware disk, so, in multiple concurrent commit commit, they will wait for the commit to be processed after saving to disk in the operation, thereby reducing the efficiency. while apply is only the atomic commit to the content, the subsequent call to apply the function will directly overwrite the previous memory data, which to a certain extent, improve a lot of efficiency.
3. The Apply method does not prompt for any failed prompts.
Because in a process, sharedpreference is a single instance, there is no concurrency conflict, If you do not care about the results submitted, it is recommended to use apply, of course, you need to ensure that the submission is successful and follow-up, or need to use a commit.
Reference from:
http://blog.csdn.net/jake9602/article/details/18414841
Similarities and differences between the apply and commit methods of Sharedpreference.editor