sababado / CustomLoaders

Custom Loaders for Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CustomLoaders

##Usage: StringPreferencesLoader Based on Commonsware's SharedPreferenceLoader

There are two implementations, one for native API Level 11+ development (in the base com.sababado.content package) and one for use with the Android Support package (in the com.sababado.support.v4.content package).

  • Your activity should implement the LoaderManager.LoaderCallbacks<String> interface.
  • In your onCreateLoader() method, return an instance of StringPreferencesLoader, which has a two-parameter constructor taking a context and a key in SharedPreferences to monitor.
  • When data changes in default shared preferences for the key provided in the constructor it will be returned in onLoadFinished().

In addition, there is a static persist() method that takes a SharedPreferences.Editor object and arranges to save those edits on a background thread, regardless of Android API level.

About

Custom Loaders for Android.

License:Apache License 2.0


Languages

Language:Java 69.1%Language:Shell 24.7%Language:Groovy 6.2%