MainActivity has below code for load GIF, the application gets a crash for load GIF after restart activity.
ImageView imageViewGIF = navigationView.findViewById(R.id.imageViewGIF);
Glide.with(this).asGif().load(R.drawable.gift_3).into(imageViewGIF);
Loading GIF in ImageView using glide
But when I restart the app due to some requirement using
Intent intent = new Intent(context, SplashActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
Application get a crash with below log.
FATAL EXCEPTION: main
Process: com.apppackage, PID: 19360
java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity
at android_support.qc.b(RequestManagerRetriever.java:298)
at android_support.qc.a(RequestManagerRetriever.java:123)
at android_support.ji.a(Glide.java:589)
I have used 'com.github.bumptech.glide:glide:4.2.0'