logo
down
shadow

Glide, RecyclerView: Glide returns the same picture over and over again even with different data inputs


Glide, RecyclerView: Glide returns the same picture over and over again even with different data inputs

By : Gannicus
Date : November 22 2020, 04:01 AM
I hope this helps . you should set DiskCacheStrategy to NONE and skipMemoryCache to true like this:
code :
Glide.with(DemoActivity.this)
.load(Uri.parse("file://" + imagePath))
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.into(mImage);


Share : facebook icon twitter icon
Glide: How to stop glide from loading images from cache instead load from server each time

Glide: How to stop glide from loading images from cache instead load from server each time


By : Vikranth Ganti
Date : March 29 2020, 07:55 AM
will help you Well everyone thanks a lot for help :)
I resolved this problem by disabling cache of volley library that was causing the issue but anyway thanks for help :)
code :
//disabling caching for url
        AppController.getInstance().getRequestQueue().getCache().remove(url);
Using Glide in Fragment with FirebaseDatabase and Storage resulting to Glide.with(getActivity) Null Object

Using Glide in Fragment with FirebaseDatabase and Storage resulting to Glide.with(getActivity) Null Object


By : Ahmed
Date : March 29 2020, 07:55 AM
this one helps. As per @ADM comment I tried removing ValueEventListener when fragment is detached and it did solve the issue.
Here are the added Codes for future reference:
code :
ValueEventListener mListener;
DatabaseReference mDataRef;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    FrameLayout rootView = (FrameLayout)inflater.inflate(R.layout.fragment_tch_profile, container, false);

    mListener = mDataRef.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
             {
             //SOME CODES HERE
             }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            Toast.makeText(getActivity(),"The read failed: " + databaseError.getCode(),Toast.LENGTH_SHORT).show();
        }
    });

    return rootView;
}


    @Override
    public void onDetach() {
        super.onDetach();
        if(mDataRef!=null && mListener!=null){
            mDataRef.removeEventListener(mListener);
        }
    }
App crashes when passing data from RecyclerView in Fragment to Activity with Glide

App crashes when passing data from RecyclerView in Fragment to Activity with Glide


By : Onin
Date : March 29 2020, 07:55 AM
This might help you Hello I am trying to pass data from my RecyclerView in Fragment, to my activity. But the app crashes. The code works when i try to open another activity so im guessing the error is in my Gallery.java activity. I tried putting .asBitMap where it says Glide in Gallery.java Activit, but it is marked as an error Here is my Gallery.java , the problem is:
you send a Parcelable:
code :
intent.putExtra("image_url", (Parcelable) listaPersonaje.get(position));
                intent.putExtra("image_name", (Parcelable) listaPersonaje.get(position));
String imageUrl = getIntent().getStringExtra("image_url");
           String imageName = getIntent().getStringExtra("image_name");
intent.putExtra("image_url", listaPersonaje.get(position).getImageUrl());
                intent.putExtra("image_name",listaPersonaje.get(position).getImageName());
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.your_resource);     
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); 
byte[] b = baos.toByteArray(); 
intent.putExtra("image_url", b);
byte[] b = getIntent().getByteArray("image_url");
Bitmap bmp = BitmapFactory.decodeByteArray(b, 0, b.length);
public static Bitmap drawableToBitmap (Drawable drawable) {
    Bitmap bitmap = null;

    if (drawable instanceof BitmapDrawable) {
        BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
        if(bitmapDrawable.getBitmap() != null) {
            return bitmapDrawable.getBitmap();
        }
    }

    if(drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
        bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Single color bitmap will be created of 1x1 pixel
    } else {
        bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    }

    Canvas canvas = new Canvas(bitmap);
    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);
    return bitmap;
}
   Drawable drawable = listaPersonaje.get(position).getImageUrl()
        // convert drawable to byte array
        Bitmap bitmap = drawableToBitmap(drawable);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
        byte[] b = baos.toByteArray();
        // send it
        intent.putExtra("image_url", b);
        <!----------------------------------------------->
        // receiver
        byte[] b = getIntent().getByteArray("image_url");
        // and using glide to show it 
        Glide.with(this)
                .load(b)
                .asBitmap()
                .into(imageview);
Rails 6 app install Glide.js using Yarn (webpacker) - Uncaught ReferenceError: Glide is not defined

Rails 6 app install Glide.js using Yarn (webpacker) - Uncaught ReferenceError: Glide is not defined


By : user3404789
Date : March 29 2020, 07:55 AM
around this issue In Webpack-land, you'll typically need to import a given module explicitly in every file where you want to use it. So, even though you imported Glide in app/javascripts/packs/front.js, if you want to reference it in new_slider.js, you'll need to import it there as well:
code :
// new_slider.js
import Glide from '@glidejs/glide';

// ...
How to bind RecyclerView image using Glide from data class

How to bind RecyclerView image using Glide from data class


By : BVF
Date : March 29 2020, 07:55 AM
will be helpful for those in need I am trying to bind recycler view with databinding class that is working perfectly with following code , Create BindingAdapter like below:
code :
@BindingAdapter("imageUrl")
fun setImageUrl(imgView: ImageView, imgUrl: String?){

    imgUrl?.let {
        val imgUri = it.toUri().buildUpon().scheme("https").build()
        Glide.with(imgView.context)
            .load(imgUri)
            .apply(
                RequestOptions()
                    .placeholder(R.drawable.loading_animation)
                    .error(R.drawable.ic_broken_image))
            .into(imgView)
    }
}
<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleType="centerCrop"
    imageUrl="@{viewModel.imageUrl}"/>
@BindingAdapter("itemImage")
fun ImageView.setSleepImage(item: VegetableDailyPriceCalender?) {
    val imgUri = item.vegetable.photoUrl.toUri().buildUpon().scheme("https").build()
    item?.let {
        Glide.with(context)
            .load(imgUri)
            .apply(
                RequestOptions()
                    .placeholder(R.drawable.loading_animation)
                    .error(R.drawable.ic_broken_image))
            .into(this)
    }
}
Related Posts Related Posts :
  • SSO web login in android app with customtabs
  • how to make specific button side curved
  • remove item onlongclick from listview
  • header image alignment coming wrongly in NavigationView android
  • How to add many spaces after the text in TextView
  • how to set "Back Button" , closing activies except main activity in android?
  • Unable to run emulator on Android Studio || Windows 10
  • How can I achieve this requirement using Rx Java
  • How to tilt a Node(or TransformableNode)object downwards in Sceneform(Ar Core)?
  • When to use RTL and LTR?
  • How to create a tab view (category) similar to instagram's explore tab
  • how to stop open activity while splash screen killed
  • Changing the Color of the Dynamically loaded Buttons onclick
  • Listview: Add arrows as dividers
  • Show confirmation on back/up in Fragment with Navigation Architecture Component
  • How to find the corresponding maven artifact/gradle module of an Android class from the API Docs?
  • ZXing 3.6.0 in portrait mode?
  • Can't use Subversion command line client: svn The path to the Subversion executable is probably wrong android
  • how to set spinner list value first position showing empty
  • When using PersistableBundle in onCreate, it shows me a blank page
  • Failed to resolve Bintray dependency
  • jacoco code coverage not working for Android applications
  • How to change the color of the Android scroll bumper
  • Why run Handler in main Looper thread
  • Android Studio combined chart crashes
  • Setting suggested width and height to a custom view in android
  • How to set input type and format in EditText using kotlin?
  • how to define Android Oncreate optionmenu
  • Exception on orientation change from two-pane mode to one-pane mode
  • How to access members of nested struct and assign them the values read from device tree?
  • How to measure upload progress of a huge String with Retrofit 2?
  • Runtime app localization doesn't work with app bundles
  • How create View and Putting TextView inside it in kotlin
  • how to integrate app action using actions.xml?
  • ConstraintLayout - center TextView in the root but don't override Button
  • Android Studio Text not conforming to layout_margin when I run App on Emulator
  • verifyReleaseResources apk release - react native
  • My app is not visible in share dialog even with intent filters in place
  • How to use cache or local storage?
  • Unhandled Exception in Recycler view xamarin
  • Android Workmanger PeriodicWorkRequest API work only once?
  • Using Touch ID or Face ID without storing user biometrics
  • React Native 3 button and 3 Modal
  • Token Expiration after 1 Hour in Authentication using Retrofit 2 and Logging Interceptor
  • JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException:
  • /bin/sh: adb: command not found
  • Laravel and Android with MySQL database
  • How do I initialize a collection value for a MutableLiveData object?
  • Where does the business logic go in a React-native app?
  • Is await blocking the UI thread on android?
  • React Native: Android build - App.js: Cannot read property 'bindings' of null
  • bindService restrict client to specific app
  • Compiling problem after adding databinding in android studio
  • Android navigation component perform an Action when popping backstack
  • unexpected text from the NFC tag
  • Can I write Rust code that can run on WebAssembly and Android and iOS?
  • Where does Asset Studio store the Google Play Store icon?
  • Flutter - GestureDetector onTapDown color changing
  • No Adapter attached in Bottom Navigation
  • correct use of reflection to get a Class method
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org