public class PrefsUtil extends Object
SharedPreferences
helper class
Copyright (c) 2011-2014 Bit Stadium GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Modifier and Type | Method and Description |
---|---|
static void |
applyChanges(android.content.SharedPreferences.Editor editor)
Apply SharedPreferences.Editor changes.
|
static Boolean |
applySupported()
Returns true if SharedPreferences.Editor.apply is supported.
|
String |
getFeedbackTokenFromPrefs(android.content.Context context)
Retrieves the feedback token from
SharedPreferences |
static PrefsUtil |
getInstance()
Return the singleton.
|
String |
getNameEmailFromPrefs(android.content.Context context)
Retrieves the name and email from
SharedPreferences |
void |
saveFeedbackTokenToPrefs(android.content.Context context,
String token)
Save feedback token to
SharedPreferences |
void |
saveNameEmailSubjectToPrefs(android.content.Context context,
String name,
String email,
String subject)
Save name and email to
SharedPreferences |
public static PrefsUtil getInstance()
public void saveFeedbackTokenToPrefs(android.content.Context context, String token)
SharedPreferences
context
- the context to usetoken
- the feedback tokenpublic String getFeedbackTokenFromPrefs(android.content.Context context)
SharedPreferences
context
- the context to usepublic void saveNameEmailSubjectToPrefs(android.content.Context context, String name, String email, String subject)
SharedPreferences
context
- the context to usename
- the user's nameemail
- the user's emailsubject
- the message subjectpublic String getNameEmailFromPrefs(android.content.Context context)
SharedPreferences
context
- the context to usepublic static void applyChanges(android.content.SharedPreferences.Editor editor)
editor
- the editor that should be commitedpublic static Boolean applySupported()
Copyright © 2015. All Rights Reserved.