@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.i(TAG, " requestcode: " + requestCode); Log.i(TAG, " resultCode: " + resultCode); switch (requestCode) { case 100: if (resultCode == Activity.RESULT_OK) { Uri selectedImage = imageUri; getActivity().getContentResolver().notifyChange(selectedImage, null); ContentResolver cr = getActivity().getContentResolver(); Bitmap bitmap; try { bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage); imgFavorite.setImageBitmap(bitmap); Log.i(TAG, " butmap " + bitmap.toString()); Log.i(TAG, " img view " + imgFavorite.toString()); Log.i(TAG, " img uri " + imageUri.toString()); imageAdapter.addmThumbIds(imageUri.toString()); } catch (Exception e) { Log.e("Camera", e.toString()); } finally { imageAdapter.notifyDataSetChanged(); } } } }
public void load() { ImageView imageView = mImageViewRef.get(); if (imageView != null) { ApptentiveLog.v("ApptentiveAttachmentLoader load requested:" + uri); ApptentiveLog.v("ApptentiveAttachmentLoader load requested on:" + imageView.toString()); // Handle the duplicate requests on the same grid item view LoaderRequest oldLoaderRequest = (LoaderRequest) imageView.getTag(DRAWABLE_DOWNLOAD_TAG); if (oldLoaderRequest != null) { // If old request on the same view also loads from the same source, cancel the current one if (oldLoaderRequest.getUrl().equals(uri)) { ApptentiveLog.v("ApptentiveAttachmentLoader load new request denied:" + uri); return; } // If old request on the same view loads from different source, cancel the old one oldLoaderRequest.cancel(); } if (TextUtils.isEmpty(uri)) { ApptentiveLog.v("ApptentiveAttachmentLoader loadDrawable(clear)"); loadDrawable(null); imageView.setTag(DRAWABLE_DOWNLOAD_TAG, null); return; } Bitmap cachedBitmap = (bLoadImage) ? (Bitmap) bitmapMemoryCache.getObjectFromCache( ImageMemoryCache.generateMemoryCacheEntryKey( uri, imageViewWidth, imageViewHeight)) : null; if (cachedBitmap != null) { mWasDownloaded = false; ApptentiveLog.v("ApptentiveAttachmentLoader loadDrawable(found in cache)"); loadDrawable(cachedBitmap); imageView.setTag(DRAWABLE_DOWNLOAD_TAG, null); } else { imageView.setTag(DRAWABLE_DOWNLOAD_TAG, this); if (bLoadImage) { loadImageFromDisk(imageView); } else { loadAttachmentFromDisk(imageView); } } } }