Code example for SoftReference

0
	private SoftReference<Activity> softActivity = null;
 
	public TiDrawableReference(Activity activity, DrawableReferenceType type)
	{ 
		this.type = type;
		softActivity = new SoftReference<Activity>(activity);
		ApplicationInfo appInfo;
 
		if (activity != null) {
			appInfo = activity.getApplicationInfo();
		} else { 
			appInfo = TiApplication.getInstance().getApplicationInfo();
		} 
		anyDensityFalse = (appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) == 0;
		decodeRetries = DEFAULT_DECODE_RETRIES;
	} 
 
	/** 
	 * A very primitive implementation based on org.apache.commons.lang3.builder.HashCodeBuilder, 
	 * which is licensed under Apache 2.0 license. 
	 * @see <a href="http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java?view=markup">HashCodeBuilder</a>