android - How to solve these about SharedPreference? -
i read post sharedpreference use auto-login using retrofit2 , okhttp3.
i learned , copied code googling,
public class addcookiesinterceptor implements interceptor { @override public response intercept(chain chain) throws ioexception { request.builder builder = chain.request().newbuilder(); // author said it's getting cookies. can't understand, can't use code set<string> preferences = sharedpreferencebase.getsharedpreference(apipreferences.shared_preference_name_cookie, new hashset<string>()); (string cookie : preferences) { builder.addheader("cookie", cookie); } return chain.proceed(builder.build()); } }
codes : http://gun0912.tistory.com/50
from these, can't understand , don't know set<string> preferences = sharedpreferencebase.getsharedpreference(apipreferences.shared_preference_name_cookie, new hashset<string>());
part.
what
sharedpreferencebase
,apipreferences.shared_preference_name_cookie
means?i want know , how write sharedpreferencebase code.
if write sharedpreference on loginactivity or mainactivity, can't in right way addcookiesinterceptor activities. cause of poor level of programming.
Comments
Post a Comment