List of usage examples for android.widget ImageView setImageDrawable
public void setImageDrawable(@Nullable Drawable drawable)
From source file:com.asksven.betterbatterystats.adapters.StatsAdapter.java
public View getView(int position, View convertView, ViewGroup viewGroup) { StatElement entry = m_listData.get(position); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.m_context); boolean bShowBars = sharedPrefs.getBoolean("show_gauge", false); if (LogSettings.DEBUG) { Log.i(TAG, "Values: " + entry.getVals()); }//from w w w . j ava 2s . c om if (convertView == null) { LayoutInflater inflater = (LayoutInflater) m_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // depending on settings show new pie gauge or old bar gauge if (!bShowBars) { convertView = inflater.inflate(R.layout.stat_row, null); } else { convertView = inflater.inflate(R.layout.stat_row_gauge, null); } } final float scale = this.m_context.getResources().getDisplayMetrics().density; TextView tvName = (TextView) convertView.findViewById(R.id.TextViewName); ///////////////////////////////////////// // we do some stuff here to handle settings about font size and thumbnail size String fontSize = sharedPrefs.getString("medium_font_size", "16"); int mediumFontSize = Integer.parseInt(fontSize); //we need to change "since" fontsize tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, mediumFontSize); // We need to handle an exception here: Sensors do not have a name so we use the fqn instead if (entry instanceof SensorUsage) { tvName.setText(entry.getFqn(UidNameResolver.getInstance(m_context))); } else { tvName.setText(entry.getName()); } boolean bShowKb = sharedPrefs.getBoolean("enable_kb", true); ImageView iconKb = (ImageView) convertView.findViewById(R.id.imageKB); iconKb.setVisibility(View.INVISIBLE); TextView tvFqn = (TextView) convertView.findViewById(R.id.TextViewFqn); tvFqn.setText(entry.getFqn(UidNameResolver.getInstance(m_context))); TextView tvData = (TextView) convertView.findViewById(R.id.TextViewData); // for alarms the values is wakeups per hour so we need to take the time as reference for the text if (entry instanceof Alarm) { tvData.setText(entry.getData((long) m_timeSince)); } else { tvData.setText(entry.getData((long) m_maxValue)); } //LinearLayout myLayout = (LinearLayout) convertView.findViewById(R.id.LinearLayoutBar); LinearLayout myFqnLayout = (LinearLayout) convertView.findViewById(R.id.LinearLayoutFqn); LinearLayout myRow = (LinearLayout) convertView.findViewById(R.id.LinearLayoutEntry); // long press for "copy to clipboard" convertView.setOnLongClickListener(new OnItemLongClickListener(position)); if (!bShowBars) { GraphablePie gauge = (GraphablePie) convertView.findViewById(R.id.Gauge); ///////////////////////////////////////// // we do some stuff here to handle settings about font size and thumbnail size String iconDim = sharedPrefs.getString("thumbnail_size", "56"); int iconSize = Integer.parseInt(iconDim); int pixels = (int) (iconSize * scale + 0.5f); //we need to change "since" fontsize gauge.getLayoutParams().height = pixels; gauge.getLayoutParams().width = pixels; gauge.requestLayout(); //////////////////////////////////////////////////////////////////////////////////// if (entry instanceof NetworkUsage) { gauge.setValue(entry.getValues()[0], ((NetworkUsage) entry).getTotal()); } else { double max = m_maxValue; // avoid rounding errors leading to values > 100 % if (entry.getValues()[0] > max) { max = entry.getValues()[0]; Log.i(TAG, "Upping gauge max to " + max); } gauge.setValue(entry.getValues()[0], max); } } else { GraphableBars buttonBar = (GraphableBars) convertView.findViewById(R.id.ButtonBar); int iHeight = 10; try { iHeight = Integer.valueOf(sharedPrefs.getString("graph_bar_height", "10")); } catch (Exception e) { iHeight = 10; } if (iHeight == 0) { iHeight = 10; } buttonBar.setMinimumHeight(iHeight); buttonBar.setName(entry.getName()); buttonBar.setValues(entry.getValues(), m_maxValue); } ImageView iconView = (ImageView) convertView.findViewById(R.id.icon); LinearLayout iconLayout = (LinearLayout) convertView.findViewById(R.id.LayoutIcon); ///////////////////////////////////////// // we do some stuff here to handle settings about font size and thumbnail size String iconDim = sharedPrefs.getString("thumbnail_size", "56"); int iconSize = Integer.parseInt(iconDim); int pixels = (int) (iconSize * scale + 0.5f); //we need to change "since" fontsize iconView.getLayoutParams().width = pixels; iconView.getLayoutParams().height = pixels; iconView.requestLayout(); //n 20;setLay.setTextSize(TypedValue.COMPLEX_UNIT_DIP, iconSize); //////////////////////////////////////////////////////////////////////////////////// // add on click listener for the icon only if KB is enabled // if (bShowKb) // { // // set a click listener for the list // iconKb.setOnClickListener(new OnIconClickListener(position)); // } // show / hide fqn text if ((entry instanceof Process) || (entry instanceof State) || (entry instanceof Misc) || (entry instanceof NativeKernelWakelock) || (entry instanceof Alarm) || (entry instanceof SensorUsage)) { myFqnLayout.setVisibility(View.GONE); } else { myFqnLayout.setVisibility(View.VISIBLE); } // show / hide package icons (we show / hide the whole layout as it contains a margin that must be hidded as well if ((entry instanceof NativeKernelWakelock) || (entry instanceof State) || (entry instanceof Misc)) { iconView.setVisibility(View.GONE); } else { iconView.setVisibility(View.VISIBLE); iconView.setImageDrawable(entry.getIcon(UidNameResolver.getInstance(m_context))); // set a click listener for the list iconView.setOnClickListener(new OnPackageClickListener(position)); } // add on click listener for the list entry if details are availble if ((entry instanceof Alarm) || (entry instanceof NativeKernelWakelock) || (entry instanceof SensorUsage)) { convertView.setOnClickListener(new OnItemClickListener(position)); } // // show / hide set dividers // ListView myList = (ListView) convertView.getListView(); //findViewById(R.id.id.list); // myList.setDivider(new ColorDrawable(0x99F10529)); // myList.setDividerHeight(1); return convertView; }
From source file:com.example.aitor2.myapplication.DrawerArrowSample.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); setContentView(R.layout.home_view);/* ww w .ja va2 s . co m*/ final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator); final Resources resources = getResources(); drawer_adapter adapter = new drawer_adapter(this, icons, titles); ListView lv = (ListView) findViewById(R.id.drawer_listview); lv.setAdapter(adapter); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { drawer.closeDrawer(START); if (position == 0) { Intent intent = new Intent(DrawerArrowSample.this, DrawerArrowSample.class); startActivity(intent); finish(); } else if (position == 1) { Intent intent = new Intent(DrawerArrowSample.this, misReservas.class); startActivity(intent); finish(); } } }); findViewById(R.id.pink_icon).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(DrawerArrowSample.this, "Clicked pink Floating Action Button", Toast.LENGTH_SHORT) .show(); } }); actionB = (FloatingActionButton) findViewById(R.id.pink_icon); actionB.setStrokeVisible(true); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.activity_main_swipe_refresh_layout); swipeRefreshLayout.setOnRefreshListener(onRefreshListener); swipeRefreshLayout.setColorSchemeColors(Color.BLACK, Color.GREEN, Color.BLACK, Color.GREEN); drawerArrowDrawable = new DrawerArrowDrawable(resources); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { offset = slideOffset; // Sometimes slideOffset ends up so close to but not quite 1 or 0. if (slideOffset >= .995) { flipped = true; drawerArrowDrawable.setFlip(flipped); } else if (slideOffset <= .005) { flipped = false; drawerArrowDrawable.setFlip(flipped); } drawerArrowDrawable.setParameter(offset); } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (drawer.isDrawerVisible(START)) { drawer.closeDrawer(START); } else { drawer.openDrawer(START); } } }); final TextView styleButton = (TextView) findViewById(R.id.indicator_style); styleButton.setOnClickListener(new View.OnClickListener() { boolean rounded = false; @Override public void onClick(View v) { styleButton.setText(rounded // ? resources.getString(R.string.rounded) // : resources.getString(R.string.squared)); rounded = !rounded; drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded); drawerArrowDrawable.setParameter(offset); drawerArrowDrawable.setFlip(flipped); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); } }); /////////////////////create expandable listview new expandable().execute(); ////////////////////calendario // Pop up Date picker on pressing the editText }
From source file:com.bitmaphandler.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.// w ww. j a va2 s . co m * * @param imageView * @param drawable */ @SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable }); if (useLoadingImage && mLoadingBitmap != null) { // Set background to loading bitmap if (imageView instanceof CircleImageView) { if (!Utils.hasJellyBean()) { imageView.setBackgroundDrawable(new BitmapDrawable(mResources, CircleImageView.getCroppedBitmap(mLoadingBitmap, mLoadingBitmap.getWidth()))); } else { imageView.setBackground(new BitmapDrawable(mResources, CircleImageView.getCroppedBitmap(mLoadingBitmap, mLoadingBitmap.getWidth()))); } } else if (imageView instanceof RoundedBitmapDisplayer) { if (!Utils.hasJellyBean()) { imageView.setBackgroundDrawable( new BitmapDrawable(mResources, RoundedBitmapDisplayer.roundCorners(mLoadingBitmap, imageView, ((RoundedBitmapDisplayer) imageView).getRoundPixle()))); } else { imageView.setBackground(new BitmapDrawable(mResources, RoundedBitmapDisplayer.roundCorners( mLoadingBitmap, imageView, ((RoundedBitmapDisplayer) imageView).getRoundPixle()))); } } else { if (!Utils.hasJellyBean()) { imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); } else { imageView.setBackground(new BitmapDrawable(mResources, mLoadingBitmap)); } } } imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.image.cache.util.ImageWorker.java
public void loadImageCustom(Object data, ImageView imageView) { if (data == null) { return;//from w ww . j a v a 2 s . c o m } BitmapDrawable value = null; if (mImageCache != null) { value = mImageCache.getBitmapFromMemCache(String.valueOf(data)); } if (value != null) { // Bitmap found in memory cache // imageView.setImageDrawable(value); // Bitmap bmp = ImageHelper.createFramedImage(value, BORDER_THICKNESS); // Drawable d = new BitmapDrawable(mResources, bmp); // imageView.setImageDrawable(d); if (BORDER_RADIUS > 0 && COLOR < 0) { // Log.e("IMAGE", "BORDER_RADIUS"); Bitmap bmp = ImageHelper.getRoundedCornerBitmap3(value, BORDER_RADIUS); Drawable d = new BitmapDrawable(mResources, bmp); setImageDrawableFrame(imageView, d); } else if (BORDER_THICKNESS == -1 && BORDER_RADIUS == -1) { // Log.e("IMAGE", " NO BORDER_THICKNESS - NO BORDER_RADIUS"); setImageDrawable(imageView, value); } else if (BORDER_THICKNESS > 0 && COLOR > 0) { // Log.e("IMAGE", "BORDER_THICKNESS - COLOR"); Bitmap bmp = ImageHelper.createRoundedFramedImage(value, BORDER_THICKNESS, COLOR); Drawable d = new BitmapDrawable(mResources, bmp); setImageDrawableFrame(imageView, d); } else if (BORDER_THICKNESS > 0) { // Log.e("IMAGE", "BORDER_THICKNESS"); Bitmap bmp = ImageHelper.createFramedImage(value, BORDER_THICKNESS); Drawable d = new BitmapDrawable(mResources, bmp); setImageDrawableFrame(imageView, d); } } else if (cancelPotentialWork(data, imageView)) { final BitmapWorkerTask task = new BitmapWorkerTask(imageView); final AsyncDrawable asyncDrawable = new AsyncDrawable(mResources, mLoadingBitmap, task); imageView.setImageDrawable(asyncDrawable); // NOTE: This uses a custom version of AsyncTask that has been pulled from the // framework and slightly modified. Refer to the docs at the top of the class // for more info on what was changed. task.executeOnExecutor(AsyncTask.DUAL_THREAD_EXECUTOR, data); } }
From source file:com.channelsoft.common.bitmapUtil.ImageWorker.java
private void loadImage(ImageView imageView, ImageParams params) { if (imageView == null) { return;//from w w w . j a v a 2 s . c om } Bitmap bitmap = null; if (mImageCache != null) { // if (params.loadType == ImageParams.LOAD_TYPE_LOCAL) { bitmap = mImageCache.getBitmapFromMemCache(params.path + params.reqWidth + params.reqHeight); } else if (params.loadType == ImageParams.LOAD_TYPE_THUMB_ID) { bitmap = mImageCache.getBitmapFromMemCache(params.thumbType + params.thumbId); } else if (params.loadType == ImageParams.LOAD_TYPE_THUMB_PATH) { bitmap = mImageCache.getBitmapFromMemCache(params.path); } else if (params.loadType == ImageParams.LOAD_TYPE_HTTP) { bitmap = mImageCache.getBitmapFromMemCache(params.path + params.reqWidth + params.reqHeight); } } if (bitmap != null) { if ("0".equals(imageView.getTag())) { // ?? bitmap = toGrayscale(bitmap); } imageView.setImageBitmap(bitmap); if (params.loadAfterListener != null) { params.loadAfterListener.onImgLoadAfter(true); } } else if (cancelPotentialWork(TextUtils.isEmpty(params.path) ? params.thumbId : params.path, imageView)) { final BitmapWorkerTask task = new BitmapWorkerTask(imageView); final AsyncDrawable asyncDrawable = new AsyncDrawable(mResources, mLoadingBitmap, task); imageView.setImageDrawable(asyncDrawable); // NOTE: This uses a custom version of AsyncTask that has been pulled from the // framework and slightly modified. Refer to the docs at the top of the class // for more info on what was changed. if (params.loadType == ImageParams.LOAD_TYPE_HTTP) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); } else { task.executeOnExecutor(AsyncTask.DUAL_THREAD_EXECUTOR, params); } } }
From source file:com.androidquery.AQuery.java
/** * Set the image of an ImageView./*from ww w . j a v a 2 s . c o m*/ * * @param drawable the drawable * @return self * * @see testImage2 * */ public AQuery image(Drawable drawable) { if (view instanceof ImageView) { ImageView iv = (ImageView) view; iv.setTag(AQuery.TAG_URL, null); iv.setImageDrawable(drawable); } return self(); }
From source file:com.androidquery.AbstractAQuery.java
/** * Set the image of an ImageView./* w w w . j a va 2 s. c om*/ * * @param drawable the drawable * @return self * * @see testImage2 * */ public T image(Drawable drawable) { if (view instanceof ImageView) { ImageView iv = (ImageView) view; iv.setTag(AQuery.TAG_URL, null); iv.setImageDrawable(drawable); } return self(); }
From source file:com.anysoftkeyboard.AnySoftKeyboard.java
@Override public void setCandidatesView(@NonNull View view) { super.setCandidatesView(view); mCandidatesParent = view.getParent() instanceof View ? (View) view.getParent() : null; mCandidateView = (CandidateView) view.findViewById(R.id.candidates); mCandidateView.setService(this); setCandidatesViewShown(false);/*from ww w . j av a 2 s . c o m*/ final KeyboardTheme theme = KeyboardThemeFactory.getCurrentKeyboardTheme(getApplicationContext()); final TypedArray a = theme.getPackageContext().obtainStyledAttributes(null, R.styleable.AnyKeyboardViewTheme, 0, theme.getThemeResId()); int closeTextColor = ContextCompat.getColor(this, R.color.candidate_other); float fontSizePixel = getResources().getDimensionPixelSize(R.dimen.candidate_font_height); Drawable suggestionCloseDrawable = null; try { closeTextColor = a.getColor(R.styleable.AnyKeyboardViewTheme_suggestionOthersTextColor, closeTextColor); fontSizePixel = a.getDimension(R.styleable.AnyKeyboardViewTheme_suggestionTextSize, fontSizePixel); suggestionCloseDrawable = a.getDrawable(R.styleable.AnyKeyboardViewTheme_suggestionCloseImage); } catch (Exception e) { e.printStackTrace(); } a.recycle(); mCandidateCloseText = (TextView) view.findViewById(R.id.close_suggestions_strip_text); ImageView closeIcon = (ImageView) view.findViewById(R.id.close_suggestions_strip_icon); if (suggestionCloseDrawable != null) closeIcon.setImageDrawable(suggestionCloseDrawable); closeIcon.setOnClickListener(new OnClickListener() { // two seconds is enough. private static final long DOUBLE_TAP_TIMEOUT = 2 * 1000 - 50; public void onClick(View v) { mKeyboardHandler.removeMessages(KeyboardUIStateHandler.MSG_REMOVE_CLOSE_SUGGESTIONS_HINT); mCandidateCloseText.setVisibility(View.VISIBLE); mCandidateCloseText.startAnimation( AnimationUtils.loadAnimation(getApplicationContext(), R.anim.close_candidates_hint_in)); mKeyboardHandler.sendMessageDelayed( mKeyboardHandler.obtainMessage(KeyboardUIStateHandler.MSG_REMOVE_CLOSE_SUGGESTIONS_HINT), DOUBLE_TAP_TIMEOUT); } }); mCandidateCloseText.setTextColor(closeTextColor); mCandidateCloseText.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSizePixel); mCandidateCloseText.setOnClickListener(new OnClickListener() { public void onClick(View v) { mKeyboardHandler.removeMessages(KeyboardUIStateHandler.MSG_REMOVE_CLOSE_SUGGESTIONS_HINT); mCandidateCloseText.setVisibility(View.GONE); abortCorrectionAndResetPredictionState(true); } }); }
From source file:com.filemanager.free.activities.MainActivity.java
public void bbar(final Main main) { final String text = main.CURRENT_PATH; try {/*from w w w. j av a 2 s .co m*/ buttons.removeAllViews(); buttons.setMinimumHeight(pathbar.getHeight()); Drawable arrow = ContextCompat.getDrawable(con, R.drawable.abc_ic_ab_back_holo_dark); Bundle b = utils.getPaths(text, this); ArrayList<String> names = b.getStringArrayList("names"); ArrayList<String> rnames = new ArrayList<String>(); assert names != null; for (int i = names.size() - 1; i >= 0; i--) { rnames.add(names.get(i)); } ArrayList<String> paths = b.getStringArrayList("paths"); final ArrayList<String> rpaths = new ArrayList<String>(); assert paths != null; for (int i = paths.size() - 1; i >= 0; i--) { rpaths.add(paths.get(i)); } View view = new View(this); LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(toolbar.getContentInsetLeft(), LinearLayout.LayoutParams.WRAP_CONTENT); view.setLayoutParams(params1); buttons.addView(view); for (int i = 0; i < names.size(); i++) { final int k = i; ImageView v = new ImageView(this); v.setImageDrawable(arrow); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.CENTER_VERTICAL; v.setLayoutParams(params); final int index = i; if (rpaths.get(i).equals("/")) { ImageButton ib = new ImageButton(this); ib.setImageDrawable(icons.getRootDrawable()); ib.setBackgroundColor(Color.parseColor("#00ffffff")); ib.setOnClickListener(new View.OnClickListener() { public void onClick(View p1) { main.loadlist(("/"), false, main.openMode); timer.cancel(); timer.start(); } }); ib.setLayoutParams(params); buttons.addView(ib); if (names.size() - i != 1) buttons.addView(v); } else if (isStorage(rpaths.get(i))) { ImageButton ib = new ImageButton(this); ib.setImageDrawable(icons.getSdDrawable()); ib.setBackgroundColor(Color.parseColor("#00ffffff")); ib.setOnClickListener(new View.OnClickListener() { public void onClick(View p1) { main.loadlist((rpaths.get(k)), false, main.openMode); timer.cancel(); timer.start(); } }); ib.setLayoutParams(params); buttons.addView(ib); if (names.size() - i != 1) buttons.addView(v); } else { Button button = new Button(this); button.setText(rnames.get(index)); button.setTextColor(ContextCompat.getColor(con, android.R.color.white)); button.setTextSize(13); button.setLayoutParams(params); button.setBackgroundResource(0); button.setOnClickListener(new Button.OnClickListener() { public void onClick(View p1) { main.loadlist((rpaths.get(k)), false, main.openMode); main.loadlist((rpaths.get(k)), false, main.openMode); timer.cancel(); timer.start(); } }); button.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { File file1 = new File(rpaths.get(index)); copyToClipboard(MainActivity.this, file1.getPath()); Toast.makeText(MainActivity.this, getResources().getString(R.string.pathcopied), Toast.LENGTH_SHORT).show(); return false; } }); buttons.addView(button); if (names.size() - i != 1) buttons.addView(v); } } scroll.post(new Runnable() { @Override public void run() { sendScroll(scroll); sendScroll(scroll1); } }); if (buttons.getVisibility() == View.VISIBLE) { timer.cancel(); timer.start(); } } catch (Exception e) { e.printStackTrace(); System.out.println("button view not available"); } }
From source file:com.android.tv.settings.dialog.DialogFragment.java
private void setContentView(View content) { TextView titleView = (TextView) content.findViewById(R.id.title); TextView breadcrumbView = (TextView) content.findViewById(R.id.breadcrumb); TextView descriptionView = (TextView) content.findViewById(R.id.description); titleView.setText(mTitle);//from ww w. j ava 2 s. c om breadcrumbView.setText(mBreadcrumb); descriptionView.setText(mDescription); final ImageView iconImageView = (ImageView) content.findViewById(R.id.icon); if (mIconBackgroundColor != Color.TRANSPARENT) { iconImageView.setBackgroundColor(mIconBackgroundColor); } if (AccessibilityHelper.forceFocusableViews(getActivity())) { titleView.setFocusable(true); titleView.setFocusableInTouchMode(true); descriptionView.setFocusable(true); descriptionView.setFocusableInTouchMode(true); breadcrumbView.setFocusable(true); breadcrumbView.setFocusableInTouchMode(true); } if (mIconResourceId != 0) { iconImageView.setImageResource(mIconResourceId); updateViewSize(iconImageView); } else { if (mIconBitmap != null) { iconImageView.setImageBitmap(mIconBitmap); updateViewSize(iconImageView); } else { if (mIconUri != null) { iconImageView.setVisibility(View.INVISIBLE); DrawableDownloader bitmapDownloader = DrawableDownloader.getInstance(content.getContext()); mBitmapCallBack = new BitmapCallback() { @Override public void onBitmapRetrieved(Drawable bitmap) { if (bitmap != null) { mIconBitmap = (bitmap instanceof BitmapDrawable) ? ((BitmapDrawable) bitmap).getBitmap() : null; iconImageView.setVisibility(View.VISIBLE); iconImageView.setImageDrawable(bitmap); updateViewSize(iconImageView); } } }; bitmapDownloader.getBitmap(new BitmapWorkerOptions.Builder(content.getContext()) .resource(mIconUri).width(iconImageView.getLayoutParams().width).build(), mBitmapCallBack); } else { iconImageView.setVisibility(View.GONE); } } } content.setTag(R.id.title, titleView); content.setTag(R.id.breadcrumb, breadcrumbView); content.setTag(R.id.description, descriptionView); content.setTag(R.id.icon, iconImageView); }