Code example for Resources

Methods: decodeResource

0
		 
		if(drawable != null && !drawable.isRecycled()) {
			return drawable;
		} 
 
		Bitmap bmp = BitmapFactory.decodeResource(resources, resourceId);
		 
		drawable = createDrawable(bmp, key);
		 
		if(tileX) {
			drawable.setTileModeX(Shader.TileMode.REPEAT);
		} 
		 
		if(tileY) {
			drawable.setTileModeY(Shader.TileMode.REPEAT);
		} 
		 
		addToCache(key, drawable, eternal);
		 
		return drawable;			
	} 
 
	public ClassLoaderProvider getClassLoaderProvider() { 
		return classLoaderProvider;
	} 
 
	public void setClassLoaderProvider(ClassLoaderProvider classLoaderProvider) {
		this.classLoaderProvider = classLoaderProvider;
	} 
 
	public DrawableCache getCache() { 
		return cache;
	} 
 
	public void setCache(DrawableCache cache) {
		this.cache = cache;
	} 
	 
	public void setBitmapUtils(BitmapUtils bitmapUtils) {
		this.bitmapUtils = bitmapUtils;
	} 
	 
	public void setMetrics(DisplayMetrics metrics) {
		this.metrics = metrics;
	} 
 
	public void setLogger(SocializeLogger logger) {
		this.logger = logger;
	} 
	 
	protected CacheableDrawable createDrawable(InputStream in, String name, boolean tileX, boolean tileY, int pixelsX, int pixelsY) {
		 
		Bitmap bitmap = bitmapUtils.getScaledBitmap ( in, pixelsX, pixelsY, DisplayMetrics.DENSITY_DEFAULT);
 
		CacheableDrawable drawable = createDrawable(bitmap, name);
		 
		if(tileX) {
			drawable.setTileModeX(Shader.TileMode.REPEAT);
		} 
		 
		if(tileY) {
			drawable.setTileModeY(Shader.TileMode.REPEAT);
		} 
		 
		return drawable;
	} 
	 
	protected CacheableDrawable createDrawable(Bitmap bitmap, String name) {
		return new CacheableDrawable(resources, bitmap, name);
	} 
	 
	protected void addToCache(String key, CacheableDrawable drawable, boolean eternal) {
		if(drawable != null) {
			cache.put(key, drawable, eternal);