List of usage examples for android.widget ImageView setImageBitmap
@android.view.RemotableViewMethod public void setImageBitmap(Bitmap bm)
From source file:com.google.android.apps.santatracker.rocketsleigh.RocketSleighActivity.java
private void addNextTransitionImages(int level) { mTransitionImagesCount = 0;//from w w w.jav a 2 s. c om if ((level > 0) && ((level - 1) < EXIT_TRANSITIONS.length)) { if (EXIT_TRANSITIONS[level - 1] != -1) { // Add the exit transition image ImageView iv = new ImageView(this); iv.setTag(new Pair<Integer, Integer>(1, (level - 1))); // This is being background loaded. Should already be loaded, but if not, wait. while (mExitTransitions[level - 1] == null) { synchronized (mExitTransitions) { if (mExitTransitions[level - 1] == null) { try { mExitTransitions.wait(); } catch (InterruptedException e) { continue; } } } } iv.setImageBitmap(mExitTransitions[level - 1]); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); mBackgroundLayout.addView(iv, lp); // No foreground on transistions. Transition images are a single screen long View view = new View(this); lp = new LinearLayout.LayoutParams(mScreenWidth, 10); mForegroundLayout.addView(view, lp); mTransitionImagesCount++; } } if ((level > 0) && (level < ENTRY_TRANSITIONS.length)) { if (ENTRY_TRANSITIONS[level] != -1) { // Add the exit transition image ImageView iv = new ImageView(this); iv.setTag(new Pair<Integer, Integer>(2, level)); // This is being background loaded. Should already be loaded, but if not, wait. while (mEntryTransitions[level] == null) { synchronized (mEntryTransitions) { if (mEntryTransitions[level] == null) { try { mEntryTransitions.wait(); } catch (InterruptedException e) { continue; } } } } iv.setImageBitmap(mEntryTransitions[level]); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); mBackgroundLayout.addView(iv, lp); // No foreground on transistions. Transition images are a single screen long View view = new View(this); lp = new LinearLayout.LayoutParams(mScreenWidth, 10); mForegroundLayout.addView(view, lp); mTransitionImagesCount++; } } }
From source file:com.haomee.chat.activity.ChatActivity.java
/** * /*from w w w .j a v a2 s .c om*/ */ private void init_new_emotions(final String path) { File file = new File(emotions_base_path); File[] files = file.listFiles();// ? for (File f : files) { if (path == null) { return; } if (f == null) { return; } if (!file.exists() || !file.isDirectory()) { return; } // if (f.listFiles().length == 0) { // return; // } if (path.equals(f.getName())) {// ?? File[] file_image_list = f.listFiles(); image_path = new ArrayList<String>(); image_name = new ArrayList<String>(); if (file_image_list == null) { return; } for (int j = 0; j < file_image_list.length; j++) { File file_image = file_image_list[j]; try { String newFileName = new String(file_image.getName().getBytes(), "UTF-8"); if (newFileName.contains(big_cover_name) || newFileName.contains(simall_cover_name)) { // final ImageView iv_bottom_emotion = new ImageView(ChatActivity.this); Bitmap decodeFile = BitmapFactory.decodeFile(file_image.getAbsolutePath()); iv_bottom_emotion.setImageBitmap(decodeFile); int screen_width = ViewUtil.getScreenWidth(ChatActivity.this); layoutParams.width = screen_width / 8; layoutParams.height = screen_width / 8; iv_bottom_emotion.setLayoutParams(layoutParams); iv_bottom_emotion.setBackgroundResource(R.drawable.grid_line); iv_bottom_emotion.setTag(path); // imag_list.add(iv_bottom_emotion); imag_list.add(0, iv_bottom_emotion); iv_bottom_emotion.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub selected_pager = (String) iv_bottom_emotion.getTag(); iv_expression_emoji.setBackgroundResource(R.drawable.grid_line); for (ImageView iv : imag_list) { if (selected_pager.equals(iv.getTag())) { iv.setBackgroundResource(R.drawable.grid_line_press); } else { iv.setBackgroundResource(R.drawable.grid_line); } } search_selected_emotions((String) iv_bottom_emotion.getTag()); } }); ll_emotions_content.addView(iv_bottom_emotion); viewpager.setTag(tab_emotions_tag);// ? } } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }
From source file:com.android.email.activity.MessageView.java
/** * Copy data from a cursor-refreshed attachment into the UI. Called from UI thread. * * @param attachment A single attachment loaded from the provider *//*from ww w. ja v a2s .c o m*/ private void addAttachment(Attachment attachment) { AttachmentInfo attachmentInfo = new AttachmentInfo(); attachmentInfo.size = attachment.mSize; attachmentInfo.contentType = AttachmentProvider.inferMimeType(attachment.mFileName, attachment.mMimeType); attachmentInfo.name = attachment.mFileName; attachmentInfo.attachmentId = attachment.mId; LayoutInflater inflater = getLayoutInflater(); View view = inflater.inflate(R.layout.message_view_attachment, null); TextView attachmentName = (TextView) view.findViewById(R.id.attachment_name); TextView attachmentInfoView = (TextView) view.findViewById(R.id.attachment_info); ImageView attachmentIcon = (ImageView) view.findViewById(R.id.attachment_icon); Button attachmentView = (Button) view.findViewById(R.id.view); Button attachmentDownload = (Button) view.findViewById(R.id.download); if ((!MimeUtility.mimeTypeMatches(attachmentInfo.contentType, Email.ACCEPTABLE_ATTACHMENT_VIEW_TYPES)) || (MimeUtility.mimeTypeMatches(attachmentInfo.contentType, Email.UNACCEPTABLE_ATTACHMENT_VIEW_TYPES))) { attachmentView.setVisibility(View.GONE); } if (attachmentInfo.size > Email.MAX_ATTACHMENT_DOWNLOAD_SIZE) { attachmentView.setVisibility(View.GONE); attachmentDownload.setVisibility(View.GONE); } attachmentInfo.viewButton = attachmentView; attachmentInfo.downloadButton = attachmentDownload; attachmentInfo.iconView = attachmentIcon; view.setTag(attachmentInfo); attachmentView.setOnClickListener(this); attachmentView.setTag(attachmentInfo); attachmentDownload.setOnClickListener(this); attachmentDownload.setTag(attachmentInfo); attachmentName.setText(attachmentInfo.name); attachmentInfoView.setText(formatSize(attachmentInfo.size)); Bitmap previewIcon = getPreviewIcon(attachmentInfo); if (previewIcon != null) { attachmentIcon.setImageBitmap(previewIcon); } mAttachments.addView(view); mAttachments.setVisibility(View.VISIBLE); }
From source file:com.wallerlab.compcellscope.Image_Gallery.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_image__gallery); counter = 0;//from w w w . ja va 2s . c o m final ImageView currPic = new ImageView(this); DisplayMetrics metrics = this.getResources().getDisplayMetrics(); final int screen_width = metrics.widthPixels; SharedPreferences settings = getSharedPreferences(Folder_Chooser.PREFS_NAME, 0); //SharedPreferences.Editor edit = settings.edit(); String path = settings.getString(Folder_Chooser.location_name, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString()); //Log.d(LOG, " | " + path + " | "); TextView text1 = (TextView) findViewById(R.id.text1); final TextView text2 = (TextView) findViewById(R.id.text2); text1.setText(path); File directory = new File(path); // get all the files from a directory File[] dump_files = directory.listFiles(); Log.d(LOG, dump_files.length + " "); final File[] fList = removeElements(dump_files, "info.json"); Log.d(LOG, "Filtered Length: " + fList.length); Arrays.sort(fList, new Comparator<File>() { @Override public int compare(File file, File file2) { String one = file.toString(); String two = file2.toString(); //Log.d(LOG, "one: " + one); //Log.d(LOG, "two: " + two); int num_one = Integer.parseInt(one.substring(one.lastIndexOf("(") + 1, one.lastIndexOf(")"))); int num_two = Integer.parseInt(two.substring(two.lastIndexOf("(") + 1, two.lastIndexOf(")"))); return num_one - num_two; } }); try { writeJsonFile(fList); } catch (JSONException e) { Log.d(LOG, "JSON WRITE FAILED"); } //List names programattically LinearLayout myLinearLayout = (LinearLayout) findViewById(R.id.linear_table); final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, screen_width + 4); myLinearLayout.setOrientation(LinearLayout.VERTICAL); if (fList != null) { File cur_pic = fList[0]; BitmapFactory.Options opts = new BitmapFactory.Options(); Log.d(LOG, "\n File Location: " + cur_pic.getAbsolutePath() + " \n" + " Parent: " + cur_pic.getParent().toString() + "\n"); Bitmap myImage = BitmapFactory.decodeFile(cur_pic.getAbsolutePath(), opts); currPic.setLayoutParams(params); currPic.setImageBitmap(myImage); currPic.setId(View.generateViewId()); text2.setText(cur_pic.getName()); } myLinearLayout.addView(currPic); //Seekbar seekBar = (SeekBar) findViewById(R.id.seekBar); seekBar.setEnabled(true); seekBar.setMax(fList.length - 1); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { int progress = 0; int length = fList.length; @Override public void onProgressChanged(SeekBar seekBar, int i, boolean b) { setCounter(i); if (getCounter() <= fList.length) { File cur_pic = fList[getCounter()]; BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true; Bitmap myImage = BitmapFactory.decodeFile(cur_pic.getAbsolutePath(), opts); int image_width = opts.outWidth; int image_height = opts.outHeight; int sampleSize = image_width / screen_width; opts.inSampleSize = sampleSize; text2.setText(cur_pic.getName()); opts.inJustDecodeBounds = false; myImage = BitmapFactory.decodeFile(cur_pic.getAbsolutePath(), opts); currPic.setImageBitmap(myImage); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); //Make Button Layout LinearLayout buttonLayout = new LinearLayout(this); buttonLayout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout.LayoutParams LLParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1.0f); buttonLayout.setLayoutParams(LLParams); buttonLayout.setId(View.generateViewId()); //Button Layout Params LinearLayout.LayoutParams param_button = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1.0f); //Prev Pic Button prevPic = new Button(this); prevPic.setText("Previous"); prevPic.setId(View.generateViewId()); prevPic.setLayoutParams(param_button); prevPic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (fList != null) { decrementCounter(); if (getCounter() >= 0) { File cur_pic = fList[getCounter()]; BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true; Bitmap myImage = BitmapFactory.decodeFile(cur_pic.getAbsolutePath(), opts); int image_width = opts.outWidth; int image_height = opts.outHeight; int sampleSize = image_width / screen_width; opts.inSampleSize = sampleSize; text2.setText(cur_pic.getName()); opts.inJustDecodeBounds = false; myImage = BitmapFactory.decodeFile(cur_pic.getAbsolutePath(), opts); //Log.d(LOG, getCounter() + ""); seekBar.setProgress(getCounter()); currPic.setImageBitmap(myImage); } else { setCounter(0); } } else { Toast.makeText(Image_Gallery.this, "There are no pictures in this folder", Toast.LENGTH_SHORT); setCounter(getCounter() - 1); } } }); buttonLayout.addView(prevPic); // Next Picture Button Button nextPic = new Button(this); nextPic.setText("Next"); nextPic.setId(View.generateViewId()); nextPic.setLayoutParams(param_button); buttonLayout.addView(nextPic); nextPic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (fList != null) { incrementCounter(); if (getCounter() < fList.length) { File cur_pic = fList[getCounter()]; BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true; Bitmap myImage = BitmapFactory.decodeFile(cur_pic.getAbsolutePath(), opts); int image_width = opts.outWidth; int image_height = opts.outHeight; int sampleSize = image_width / screen_width; opts.inSampleSize = sampleSize; text2.setText(cur_pic.getName()); opts.inJustDecodeBounds = false; myImage = BitmapFactory.decodeFile(cur_pic.getAbsolutePath(), opts); //Log.d(LOG, getCounter() + ""); seekBar.setProgress(getCounter()); currPic.setImageBitmap(myImage); } else { setCounter(getCounter() - 1); } } else { Toast.makeText(Image_Gallery.this, "There are no pictures in this folder", Toast.LENGTH_SHORT); setCounter(getCounter() - 1); } } }); myLinearLayout.addView(buttonLayout); }
From source file:com.android.mtkex.chips.BaseRecipientAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { /// M: add view holder to improve performance. DropDownListViewHolder viewHolder;/*from w ww.j av a2 s . c o m*/ /// M: get view holder from convert view. @{ if (convertView == null) { convertView = mInflater.inflate(getItemLayout(), parent, false); viewHolder = new DropDownListViewHolder(); if (convertView != null) { viewHolder.name = (TextView) convertView.findViewById(getDisplayNameId()); viewHolder.dest = (TextView) convertView.findViewById(getDestinationId()); viewHolder.destType = (TextView) convertView.findViewById(getDestinationTypeId()); viewHolder.img = (ImageView) convertView.findViewById(getPhotoId()); convertView.setTag(viewHolder); } } else { viewHolder = (DropDownListViewHolder) convertView.getTag(); } /// @} final RecipientEntry entry = getEntries().get(position); String displayName = entry.getDisplayName(); String destination = entry.getDestination(); if (TextUtils.isEmpty(displayName) || TextUtils.equals(displayName, destination)) { displayName = destination; // We only show the destination for secondary entries, so clear it // only for the first level. if (entry.isFirstLevel()) { destination = null; } } /// M: get properties from view holder. @{ final View itemView = convertView; final TextView displayNameView = viewHolder.name; final TextView destinationView = viewHolder.dest; final TextView destinationTypeView = viewHolder.destType; final ImageView imageView = viewHolder.img; /// @} displayNameView.setText(displayName); if (!TextUtils.isEmpty(destination)) { destinationView.setText(destination); } else { destinationView.setText(null); } if (destinationTypeView != null) { CharSequence destinationType = null; if (mShowPhoneAndEmail) { /// M: Current query is phone query, but there may exist email results as well. /// Hence, we need to get destinationType of email results by Queries.EMAIL. @{ if (entry.getDestinationKind() == RecipientEntry.ENTRY_KIND_EMAIL) { destinationType = Queries.EMAIL.getTypeLabel(mContext.getResources(), entry.getDestinationType(), entry.getDestinationLabel()).toString().toUpperCase(); } else { destinationType = Queries.PHONE.getTypeLabel(mContext.getResources(), entry.getDestinationType(), entry.getDestinationLabel()).toString().toUpperCase(); } /// @} } else { destinationType = mQuery.getTypeLabel(mContext.getResources(), entry.getDestinationType(), entry.getDestinationLabel()).toString().toUpperCase(); } destinationTypeView.setText(destinationType); } if (entry.isFirstLevel()) { displayNameView.setVisibility(View.VISIBLE); if (imageView != null) { imageView.setVisibility(View.VISIBLE); final byte[] photoBytes = entry.getPhotoBytes(); if (photoBytes != null) { /// M: get bitmap from recipient entry Bitmap photo = entry.getBitmap(); /// M: cache bitmap if unavailable. @{ if (photo == null) { photo = BitmapFactory.decodeByteArray(photoBytes, 0, photoBytes.length); entry.setBitmap(photo); } /// @} imageView.setImageBitmap(photo); } else { imageView.setImageResource(getDefaultPhotoResource()); } } } else { displayNameView.setVisibility(View.GONE); if (imageView != null) { imageView.setVisibility(View.INVISIBLE); } } return itemView; }
From source file:com.eleybourn.bookcatalogue.utils.Utils.java
/** * Called in the UI thread, will either use a cached cover OR start a background task to create and load it. * //from w ww. j a v a 2 s .co m * If a cached image is used a background task is still started to check the file date vs the cache date. If the * cached image date is < the file, it is rebuilt. * * @param destView View to populate * @param maxWidth Max width of resulting image * @param maxHeight Max height of resulting image * @param exact Whether to fit dimensions exactly * @param bookId ID of book to retrieve. * @param checkCache Indicates if cache should be checked for this cover * @param allowBackground Indicates if request can be put in background task. * * @return Bitmap (if cached) or NULL (if done in background) */ public final Bitmap fetchBookCoverIntoImageView(final ImageView destView, int maxWidth, int maxHeight, final boolean exact, final String hash, final boolean checkCache, final boolean allowBackground) { // Get the original file so we can use the modification date, path etc File coverFile = CatalogueDBAdapter.fetchThumbnailByUuid(hash); Bitmap bm = null; boolean cacheWasChecked = false; // If we want to check the cache, AND we dont have cache building happening, then check it. if (checkCache && !GetThumbnailTask.hasActiveTasks() && !ThumbnailCacheWriterTask.hasActiveTasks()) { final String cacheId = getCoverCacheId(hash, maxWidth, maxHeight); bm = fetchCachedImageIntoImageView(coverFile, destView, cacheId); cacheWasChecked = true; } else { //System.out.println("Skipping cache check"); } if (bm != null) return bm; // Check the file exists. Otherwise set 'help' icon and exit. //if (!coverFile.exists()) { // if (destView != null) // destView.setImageResource(android.R.drawable.ic_menu_help); // return null; //} // If we get here, the image is not in the cache but the original exists. See if we can queue it. if (allowBackground) { destView.setImageBitmap(null); GetThumbnailTask.getThumbnail(hash, destView, maxWidth, maxHeight, cacheWasChecked); return null; } //File coverFile = CatalogueDBAdapter.fetchThumbnail(bookId); // File is not in cache, original exists, we are in the background task (or not allowed to queue request) return shrinkFileIntoImageView(destView, coverFile.getPath(), maxWidth, maxHeight, exact); }
From source file:com.arkami.myidkey.activity.KeyCardEditActivity.java
/** * Adds view to linear layout//from w ww . j a va2s . c o m */ private void addFileToList(final FileObject fileObject) { if (fileObject == null) { return; } if (fileObject.getId() == null) { fileObject.setId(fileDataSource.insert(fileObject)); long[] fileIds = Arrays.copyOf(keyCard.getFileIds(), keyCard.getFileIds().length + 1); fileIds[fileIds.length - 1] = fileObject.getId(); keyCard.setFileIds(fileIds); } // long[] newIds = Arrays.copyOf(keyCard.getFileIds(), // keyCard.getFileIds().length + 1); // long newId = fileObject.getId(); // newIds[newIds.length - 1] = newId; // Toast.makeText(this, newId + "", Toast.LENGTH_SHORT).show(); // keyCard.setFileIds(newIds); // keyCardDataSource.update(keyCard); final View view = View.inflate(this, R.layout.photo_audio_list_item, null); TextView fileName = (TextView) view.findViewById(R.id.photo_audio_list_item_file_name); TextView fileSize = (TextView) view.findViewById(R.id.photo_audio_list_item_file_size); ImageView thumb = (ImageView) view.findViewById(R.id.photo_audio_list_item_thumb); ImageButton close = (ImageButton) view.findViewById(R.id.photo_audio_list_item_close_button); fileName.setText(fileObject.getName()); fileSize.setText(fileObject.getSize() + " bytes"); view.setVisibility(View.VISIBLE); switch (Cache.getInstance(this).getFileTypeEnum(fileObject.getFileType())) { case audio: // add audio close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { audioLinearLayout.removeView(view); if (audioLinearLayout.getChildCount() == 0) { audioListRelativeLayout.setVisibility(View.GONE); } keyCard = removeFileID(fileObject.getId(), keyCard); // KeyCardEditActivity.this.keyCardDataSource.update(keyCard); } }); thumb.setImageResource(R.drawable.speaker); thumb.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); File file = new File(fileObject.getPathToFile()); intent.setDataAndType(Uri.fromFile(file), "audio/3gp"); Log.w("Uri.fromFile(file) = ", fileObject.getPathToFile()); startActivity(intent); } }); audioLinearLayout.addView(view); audioListRelativeLayout.setVisibility(View.VISIBLE); break; case photo: // add photo // for photo file close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { photosLinearLayout.removeView(view); if (photosLinearLayout.getChildCount() == 0) { photosListRelativeLayout.setVisibility(View.GONE); } if (fileObject.getId() != null) { keyCard = removeFileID(fileObject.getId(), keyCard); } } }); thumb.setImageBitmap(Common.getImageFromIntent(fileObject.getPathToFile(), true)); thumb.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent viewImageIntent = new Intent(KeyCardEditActivity.this, ViewImageIActivity.class); viewImageIntent.putExtra(ViewImageIActivity.IMAGE_KEY, fileObject); startActivity(viewImageIntent); } }); photosLinearLayout.addView(view); photosListRelativeLayout.setVisibility(View.VISIBLE); // end for photo file break; default: break; } }
From source file:com.amaze.carbonfilemanager.activities.MainActivity.java
void setDrawerHeaderBackground() { new Thread(new Runnable() { public void run() { if (sharedPref.getBoolean("plus_pic", false)) return; String path = sharedPref.getString("drawer_header_path", null); if (path == null) return; try { final ImageView headerImageView = new ImageView(MainActivity.this); headerImageView.setImageDrawable(drawerHeaderParent.getBackground()); mImageLoader.get(path, new ImageLoader.ImageListener() { @Override/*w w w. j a v a 2s . c o m*/ public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) { headerImageView.setImageBitmap(response.getBitmap()); drawerHeaderView.setBackgroundResource(R.drawable.amaze_header_2); } @Override public void onErrorResponse(VolleyError error) { } }); } catch (Exception e) { e.printStackTrace(); } } }).run(); }
From source file:com.eleybourn.bookcatalogue.utils.Utils.java
/** * Called in the UI thread, will return a cached image OR NULL. * //from ww w .j a va 2 s . co m * @param originalFile File representing original image file * @param destView View to populate * @param cacheId ID of the image in the cache * * @return Bitmap (if cached) or NULL (if not cached) */ public Bitmap fetchCachedImageIntoImageView(final File originalFile, final ImageView destView, final String cacheId) { Bitmap bm = null; // resultant Bitmap (which we will return) // Get the db CoversDbHelper coversDb = getCoversDb(); if (coversDb != null) { byte[] bytes; // Wrap in try/catch. It's possible the SDCard got removed and DB is now inaccessible Date expiry; if (originalFile == null) expiry = new Date(0L); else expiry = new Date(originalFile.lastModified()); try { bytes = coversDb.getFile(cacheId, expiry); } catch (Exception e) { bytes = null; } ; if (bytes != null) { try { bm = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); } catch (Exception e) { bytes = null; } ; } } if (bm != null) { // // Remove any tasks that may be getting the image because they may overwrite anything we do. // Remember: the view may have been re-purposed and have a different associated task which // must be removed from the view and removed from the queue. // if (destView != null) GetThumbnailTask.clearOldTaskFromView(destView); // We found it in cache if (destView != null) destView.setImageBitmap(bm); // Return the image } return bm; }