android-glide

java.lang.OutOfMemoryError while converting over 100 Strings into to byte arrays

大兔子大兔子 提交于 2019-12-02 11:55:40
Firstly, I understand questions regarding java.lang.OutOfMemoryError and Bitmaps have already been asked numerous times before. I have also checked out the Displaying Bitmaps Efficiently page. My use case: I am storing two different sized Bitmaps as Strings in an SQLite database. The first size of the Bitmaps is 50% of the screen width, and the second size is 100% of the screen width. I am using a RecyclerView which displays the images in ImageViews which are either 50% or 100% of the screen width, so the Bitmaps being loaded are no bigger than they need to be, and they are appropriately sized

Shared Element Transition + Fragment + RecyclerView + ViewPager

被刻印的时光 ゝ 提交于 2019-12-02 05:04:35
问题 I am implementing a gallery app, which has a Fragment that holds a RecyclerView with images, onClick of an image I go to ViewPager to cycle through images. For now, I am trying to implement just the entry animation like in this video. The problem is the animation just doesn't work, I am obviously missing something (just showing code which is relevant to transitions): ViewPager: public class ViewPagerFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater,

Shared Element Transition + Fragment + RecyclerView + ViewPager

☆樱花仙子☆ 提交于 2019-12-02 01:56:27
I am implementing a gallery app, which has a Fragment that holds a RecyclerView with images, onClick of an image I go to ViewPager to cycle through images. For now, I am trying to implement just the entry animation like in this video. The problem is the animation just doesn't work, I am obviously missing something (just showing code which is relevant to transitions): ViewPager: public class ViewPagerFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment

How to load Glide cached image in NotificationCompat.Builder.setLargeIcon()?

半城伤御伤魂 提交于 2019-12-01 20:03:10
Like this image I am trying to set notification large icon as user profile thumbnail like whatsapp or other chatting apps I have tried Glide.with(context) .asBitmap() .load(messageNotification.getLargeIcon()) .into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) { builder.setLargeIcon(resource); } }); but it is not working.. Any Help? Santanu Sur If you set the large icon using glide..the you should also notify the NotificationManager onResourceReady(resource, transition) .into(new SimpleTarget<Bitmap>() { @Override

Android, Glide shows wrong image for about one second

夙愿已清 提交于 2019-12-01 18:11:53
I'm using Glide library for loading images from URL, which I get from Graph Request (Facebook). It's used in RecyclerAdapter. When I'm scrolling, each ImageView shows wrong picture for about less than one second, then correct one. Here is the code: @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { ImageView main_image = viewHolder.main_image, getEventCover(position, main_image); } private void getEventCover(int position, final ImageView img){ GraphRequest request = GraphRequest.newGraphPathRequest( AccessToken.getCurrentAccessToken(), event.get

getDrawable() gives null object while trying to get bitmap from imageview

风格不统一 提交于 2019-12-01 18:03:49
问题 I am using glide for imageview and I want to get bitmap from that imageview-- ImageView imageView = (ImageView) findViewById(R.id.dp); Glide.with(this).load("http://graph.facebook.com/1615242245409408/picture?type=large").into(imageView); Bitmap fbbitmap2 = ((BitmapDrawable)imageView.getDrawable()).getBitmap(); But it gives java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap()' on a null object reference

Android, Glide shows wrong image for about one second

折月煮酒 提交于 2019-12-01 17:48:21
问题 I'm using Glide library for loading images from URL, which I get from Graph Request (Facebook). It's used in RecyclerAdapter. When I'm scrolling, each ImageView shows wrong picture for about less than one second, then correct one. Here is the code: @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { ImageView main_image = viewHolder.main_image, getEventCover(position, main_image); } private void getEventCover(int position, final ImageView img){

How to fix “canvas: trying to use a recycled bitmap error”?

£可爱£侵袭症+ 提交于 2019-12-01 17:40:45
I'm creating a RecyclerView to show a Grid of pictures. When selecting one of them, it should open a new activity with a transition. I'm using Glide library to load the pictures and the transition looks awful because it reloads the picture in the new activity. So I had to save it in cache, and then use it for the transition. I have the code, but sometimes if the picture doesn't load, it throws a Canvas RuntimeException. This is the log: 07-03 15:19:58.633 28461-28461/jahirfiquitiva.project E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: jahirfiquitiva.project, PID: 28461 java.lang

Glide assert: java.lang.IllegalArgumentException: You must call this method on the main thread

泪湿孤枕 提交于 2019-12-01 15:56:31
Has anyone used Glide to fetch images from a background thread? I keep getting this assert: java.lang.IllegalArgumentException: You must call this method on the main thread but according to this thread, it should work: https://github.com/bumptech/glide/issues/310 Yet, I cannot get it to work, unless I call it from the main thread. Here's is what I am trying to do from the main thread: Glide.get(mContext); loadUserImage(userImageUrl); // wait 5 seconds before trying again int imageLoadingTimeOut = mContext.getResources().getInteger(R.integer.image_loading_time_out); if (imageLoadingTimeOut > 0)

Glide 4.3.1 override and placeholder features not work

可紊 提交于 2019-12-01 15:05:11
I update my glide to 4.3.1 but all over I use glide the feature .override() and .placeholder() get error: cannot find symbol method . Glide.with(this) .load(imageUrl) .override(200, 200) .placeholder(R.drawable.ic_avatar_sign_up) .into(ivAvatar); How can I fix this? You should use RequestOptions Includes methods like: centerCrop() placeholder() error() priority() diskCacheStrategy() priority() override(100, 100) transforms() Sample code Glide.with(this) .load(YOUR_URL) .apply(new RequestOptions().override(100, 100).placeholder(R.drawable.placeHolder).error(R.drawable.error_pic)) .into