Example usage for android.content ContextWrapper getSharedPreferences

List of usage examples for android.content ContextWrapper getSharedPreferences

Introduction

In this page you can find the example usage for android.content ContextWrapper getSharedPreferences.

Prototype

@Override
public SharedPreferences getSharedPreferences(File file, int mode) 

Source Link

Usage

From source file:jp.mixi.android.sdk.MixiContainerImpl.java

/**
 * ?//  w w w  .  j  ava 2s .com
 * 
 * @param contextWrapper ?activity
 * @param listener ???????????????(?????????)
 * @return ???????true
 * @throws RemoteException
 */
boolean restoreSession(final ContextWrapper contextWrapper) {
    new Thread(new Runnable() {
        @Override
        public void run() {
            SharedPreferences prefs = contextWrapper.getSharedPreferences(MIXI_SESSION_KEY,
                    Context.MODE_PRIVATE);
            String appId = prefs.getString(CLIENT_ID, null);
            if (appId == null) {
                return;
            }
            setAccessToken(prefs.getString(ACCESS_TOKEN, null));
            setRefreshToken(prefs.getString(REFRESH_TOKEN, null));
            setAccessExpiresIn(prefs.getLong(EXPIRES, 0));
            if (isAuthorized()) {
                runAppCounter();
            }
        }
    }).start();
    if (getAccessToken() == null) {
        return false;
    }
    return true;
}