java - Need a ContentProvider to access SharedPreferences -
i dont need code this, structure of doing it.
i working on application have baseativity (extends activity) number of methods , inner class user. other activities in application extends baseativity.
the user class has methods read , write data using sharedpreferences. loginactivity extends baseactivity, , upon correct login calls user.login(args) in order create shared variable (in mode_private) user id, user email, , json user preferences.
i need create content provider use query() retrieve data logged in user. content provider data sharedpreferences , provide them appalication calling content provider.
since content provider extends contentprovider not able extend baseactivity (that solution). when calling within contentprovider's method oncreate()
user user = new baseactivity.user();
i error .... "'com.example.myapp.baseactivity' not enclosing class".
is there way call inner class user contentprovider?
if need access sharedpreferences
contentprovider
, don't need contentprovider
implement sharedpreferences
, because getsharedpreferences()
method of context available getcontext()
method of contentprovider
class.
Comments
Post a Comment