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.

  1. what sharedpreferencebase , apipreferences.shared_preference_name_cookie means?

  2. 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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -