List of usage examples for android.widget ImageView setImageBitmap
@android.view.RemotableViewMethod public void setImageBitmap(Bitmap bm)
From source file:com.velia_systems.menuphoto.connection.ImageDownloader.java
/** * Download the specified image from the Internet and binds it to the provided ImageView. The * binding is immediate if the image is found in the cache and will be done asynchronously * otherwise. A null bitmap will be associated to the ImageView if an error occurs. * * @param url The URL of the image to download. * @param imageView The ImageView to bind the downloaded image to. *///ww w. j a v a2s . c o m public void download(String url, ImageView imageView, ProgressBar progress) { resetPurgeTimer(); Bitmap bitmap = getBitmapFromCache(url); if (bitmap == null) { forceDownload(url, imageView, bitmap, progress); } else { cancelPotentialDownload(url, imageView); imageView.setImageBitmap(bitmap); progress.setVisibility(View.GONE); } }
From source file:com.inter.trade.view.slideplayview.AbSlidingPlayView.java
/** * .//from ww w . ja va 2 s . c om */ public void creatIndex() { //? pageLineLayout.removeAllViews(); mPageLineLayoutParent.setHorizontalGravity(pageLineHorizontalGravity); pageLineLayout.setGravity(Gravity.CENTER); pageLineLayout.setVisibility(View.VISIBLE); count = mListViews.size(); for (int j = 0; j < count; j++) { ImageView imageView = new ImageView(context); pageLineLayoutParams.setMargins(5, 5, 5, 5); imageView.setLayoutParams(pageLineLayoutParams); if (j == 0) { imageView.setImageBitmap(displayImage); } else { imageView.setImageBitmap(hideImage); } pageLineLayout.addView(imageView, j); } }
From source file:com.battlelancer.seriesguide.util.ImageDownloader.java
/** * Download the specified image from the Internet and binds it to the * provided ImageView. The binding is immediate if the image is found in the * cache and will be done asynchronously otherwise. A null bitmap will be * associated to the ImageView if an error occurs. * /*from w w w .java 2 s. c o m*/ * @param url The URL of the image to download. * @param imageView The ImageView to bind the downloaded image to. * @param isDiskCaching Wether to cache the image to disk or just memory. */ public void download(String url, ImageView imageView, boolean isDiskCaching) { resetPurgeTimer(); Bitmap bitmap = getBitmapFromCache(url); if (bitmap == null) { forceDownload(url, imageView, isDiskCaching); } else { cancelPotentialDownload(url, imageView); imageView.setImageBitmap(bitmap); } }
From source file:codelovers.test.androidyoutubeplayer.ImageDownloader.java
/** * Same as {@link #download(String, ImageView)}, with the possibility to * provide an additional cookie that will be used when the image will be * retrieved./* w w w. ja v a 2s .com*/ * * @param url The URL of the image to download. * @param imageView The ImageView to bind the downloaded image to. * @param cookie A cookie String that will be used by the http connection. */ public void download(String url, ImageView imageView, String cookie) { resetPurgeTimer(); Bitmap bitmap = getBitmapFromCache(url); if (bitmap == null) { Log.i(LOG_TAG, LOG_TAG + ": Error retrieving bitmap from cache " + url.split("/")[4]); forceDownload(url, imageView, cookie); } else { cancelPotentialDownload(url, imageView); imageView.setImageBitmap(bitmap); } }
From source file:com.lxh.util.pullview.AbSlidingPlayView.java
/** * .//from w ww . j a v a2 s . c o m */ public void creatIndex() { // ? navLinearLayout.removeAllViews(); mNavLayoutParent.setHorizontalGravity(navHorizontalGravity); navLinearLayout.setGravity(Gravity.CENTER); navLinearLayout.setVisibility(View.VISIBLE); count = mListViews.size(); navLayoutParams.setMargins(5, 5, 5, 5); for (int j = 0; j < count; j++) { ImageView imageView = new ImageView(context); imageView.setLayoutParams(navLayoutParams); if (j == 0) { imageView.setImageBitmap(displayImage); } else { imageView.setImageBitmap(hideImage); } navLinearLayout.addView(imageView, j); } }
From source file:com.binomed.showtime.android.util.images.ImageDownloader.java
public void download(String url, ImageView imageView, Context context) { resetPurgeTimer();/* www . ja v a 2 s . c o m*/ Bitmap bitmap = getBitmapFromCache(url); if (bitmap == null) { forceDownload(url, imageView, context); } else { cancelPotentialDownload(url, imageView); imageView.setImageBitmap(bitmap); } }
From source file:com.waveface.installer.util.ImageDownloader.java
/** * Same as download but the image is always downloaded and the cache is not used. * Kept private at the moment as its interest is not clear. *//*from ww w . j av a 2 s .co m*/ private void forceDownload(String url, ImageView imageView, int resId) { // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys. BitmapDrawable draw = (BitmapDrawable) mContext.getResources().getDrawable(resId); Bitmap bm = draw.getBitmap(); if (url == null) { imageView.setImageBitmap(bm); return; } if (cancelPotentialDownload(url, imageView)) { switch (mode) { case NO_ASYNC_TASK: Bitmap bitmap = downloadBitmap(url); addBitmapToCache(url, bitmap); imageView.setImageBitmap(bitmap); break; case NO_DOWNLOADED_DRAWABLE: imageView.setMinimumHeight(156); BitmapDownloaderTask task = new BitmapDownloaderTask(imageView); task.execute(url); break; case CORRECT: task = new BitmapDownloaderTask(imageView); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task, bm); imageView.setImageDrawable(downloadedDrawable); task.execute(url); break; } } }
From source file:org.immopoly.android.helper.ImageListDownloader.java
/** * Same as {@link #download(String, ImageView)}, with the possibility to * provide an additional cookie that will be used when the image will be * retrieved.//from w w w. java 2 s . com * * @param url * The URL of the image to download. * @param imageView * The ImageView to bind the downloaded image to. * @param cookie * A cookie String that will be used by the http connection. */ public void download(String url, ImageView imageView, String cookie) { resetPurgeTimer(); Bitmap bitmap = getBitmapFromCache(url); if (bitmap == null) { forceDownload(url, imageView, cookie); } else { // stop animation imageView.setAnimation(null); cancelPotentialDownload(url, imageView); imageView.setImageBitmap(bitmap); } }
From source file:se.dw.okhttpwrapper.ImageRequest.java
/** * Download the specified image from the Internet and binds it to the provided ImageView. The * binding is immediate if the image is found in the cache and will be done asynchronously * otherwise. A null bitmap will be associated to the ImageView if an error occurs. * * @param url The URL of the image to download. * @param imageView The ImageView to bind the downloaded image to. *///from w ww . j av a2s . c om public void execute(String url, ImageView imageView) { resetPurgeTimer(); Bitmap bitmap = getBitmapFromCache(url); if (bitmap == null) { forceDownload(url, imageView); } else { cancelPotentialDownload(url, imageView); imageView.setImageBitmap(bitmap); } }