Skip to content
This repository was archived by the owner on Sep 14, 2020. It is now read-only.
/ SharedPref Public archive

💾 [LIBRARY] An android library for making SharedPreferences easy

License

Notifications You must be signed in to change notification settings

hitanshu-dhawan/SharedPref

Repository files navigation

Deprecated

SharedPref is deprecated in favor of Jetpack DataStore.


SharedPref

An android library for making SharedPreferences simple and easy!

Download

Gradle

implementation 'com.hitanshudhawan:shared-pref:1.0.0'

Usage

Initialize

SharedPref sharedPref = new SharedPref(context);
// or
SharedPref sharedPref = new SharedPref(context, name);
// or
SharedPref sharedPref = new SharedPref(context, name, mode);

Default file name will be packageName of your project.
Default operating mode will be MODE_PRIVATE.

Put

sharedPref.putString(key, value);
sharedPref.putInt(key, value);
sharedPref.putLong(key, value);
// and many more...

Get

sharedPref.getString(key, defValue);
sharedPref.getInt(key, defValue);
sharedPref.getLong(key, defValue);
// and many more...

and that's it! No need for commit() or apply().

Licence

Copyright (c) 2018 Hitanshu Dhawan

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

💾 [LIBRARY] An android library for making SharedPreferences easy

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages