Example usage for java.lang.ref WeakReference WeakReference

List of usage examples for java.lang.ref WeakReference WeakReference

Introduction

In this page you can find the example usage for java.lang.ref WeakReference WeakReference.

Prototype

public WeakReference(T referent) 

Source Link

Document

Creates a new weak reference that refers to the given object.

Usage

From source file:com.anysoftkeyboard.addons.AddOnImpl.java

protected AddOnImpl(Context askContext, Context packageContext, String id, @StringRes int nameResId,
        String description, boolean hidden, int sortIndex) {
    mId = id;/* www.  j a  v  a 2s.co m*/
    mAskAppContext = askContext;
    mName = packageContext.getString(nameResId);
    mDescription = description;
    mPackageName = packageContext.getPackageName();
    mPackageContext = new WeakReference<>(packageContext);
    mSortIndex = sortIndex;
    mAddOnResourceMapping = new AddOnResourceMappingImpl(this);
    mHiddenAddOn = hidden;
}

From source file:com.dm.material.dashboard.candybar.tasks.IconsLoaderTask.java

private IconsLoaderTask(Context context) {
    mContext = new WeakReference<>(context);
}

From source file:com.dycody.android.idealnote.async.CategoryMenuTask.java

public CategoryMenuTask(Fragment mFragment) {
    mFragmentWeakReference = new WeakReference<>(mFragment);
    this.mainActivity = (MainActivity) mFragment.getActivity();
}

From source file:com.couchbase.lite.support.PersistentCookieStore.java

/**
 * Construct a persistent cookie store.//w ww  .  j  ava 2s  .  c o m
 */
public PersistentCookieStore(Database db) {

    this.dbWeakRef = new WeakReference<Database>(db);

    cookies = new ConcurrentHashMap();

    // Load any previously stored cookies into the store
    loadPreviouslyStoredCookies(db);

    // Clear out expired cookies
    clearExpired(new Date());

}

From source file:com.amaze.filemanager.asynchronous.asynctasks.compress.GzipHelperTask.java

public GzipHelperTask(Context context, String filePath, String relativePath, boolean goBack,
        OnAsyncTaskFinished<ArrayList<CompressedObjectParcelable>> l) {
    super(goBack, l);
    this.context = new WeakReference<>(context);
    this.filePath = filePath;
    this.relativePath = relativePath;
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.threads.VitroBackgroundThread.java

public VitroBackgroundThread(String name) {
    super(name);
    allThreads.add(new WeakReference<VitroBackgroundThread>(this));
}

From source file:ca.frozen.curlingtv.activities.ScannerFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);// w w w  .j  a v a2  s  .co  m

    // load the settings and cameras
    Utils.loadData();

    // create and run the scanner asynchronously
    DeviceScanner scanner = new DeviceScanner(this);
    scannerWeakRef = new WeakReference<>(scanner);
    scanner.execute();
}

From source file:com.dm.material.dashboard.candybar.tasks.IconRequestTask.java

private IconRequestTask(Context context) {
    mContext = new WeakReference<>(context);
}

From source file:de.xaniox.heavyspleef.core.player.SpleefPlayer.java

public SpleefPlayer(Player bukkitPlayer, HeavySpleef heavySpleef) {
    this.bukkitPlayerRef = new WeakReference<Player>(bukkitPlayer);
    this.online = bukkitPlayer.isOnline();
    this.playerStates = Maps.newHashMap();
    this.name = bukkitPlayer.getName();
    this.heavySpleef = heavySpleef;
}

From source file:com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutionJob.java

/**
 * Creates a new JavaScript execution job, where the JavaScript code to execute is a string.
 * @param initialDelay the initial amount of time to wait before executing this job
 * @param period the amount of time to wait between executions of this job (may be {@code null})
 * @param label the label for the job//from   www . ja  v a  2 s .co m
 * @param window the window to which the job belongs
 */
JavaScriptExecutionJob(final int initialDelay, final Integer period, final String label,
        final WebWindow window) {
    super(initialDelay, period);
    label_ = label;
    window_ = new WeakReference<>(window);
}