正在加载图片...
Differences Between Methods apply( and commit boolean commit o Returns a boolean value to indicate if the new values were successfully written to persistent storage o Writes its preferences out to persistent storage synchronously (can block the Ul thread) void apply o Commits its changes to the in-memory SharedPreferences immediately but starts an asynchronous commit to disk o does not block the UI thread, but you wont be notified of any failures Use apply( if you don t care about the return value and you're using this from your application's Ul thread http://developer.androidcom/referencelandroid/content/sharedPreferences.EditorhtmlDifferences Between Methods apply() and commit() • boolean commit() o Returns a boolean value to indicate if the new values were successfully written to persistent storage. o Writes its preferences out to persistent storage synchronously (can block the UI thread) • void apply() o Commits its changes to the in-memory SharedPreferences immediately but starts an asynchronous commit to disk. o does not block the UI thread, but you won’t be notified of any failures. Use apply() if you don't care about the return value and you’re using this from your application’s UI thread. http://developer.android.com/reference/android/content/SharedPreferences.Editor.html 16
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有