2017-11-18 20 views
0

MainActivity는로드 GIF 코드 아래에 있으며, 다시 시작한 후에로드 GIF가 발생하면 응용 프로그램에 충돌이 발생합니다.파괴 된 활동에 대한로드를 시작할 수 없습니다. Glide

ImageView imageViewGIF = navigationView.findViewById(R.id.imageViewGIF); 
    Glide.with(this).asGif().load(R.drawable.gift_3).into(imageViewGIF); 

로드 이미지 뷰에있는 GIF를 사용 글라이드

하지만 때문에

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(); 

응용 프로그램 로그에 다음과 충돌을 얻을 사용하여 몇 가지 요구 사항에 응용 프로그램을 다시 시작할 때.

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) 

나는 누군가가이 문제를 해결하는 데 도움이

'com.github.bumptech.glide:glide:4.2.0'을 사용했다.

+0

글라이드를 어디에서 사용하고 있습니까? 파편, 활동 또는 고객보기 내부? –

+0

@AshishTiwari는'onCreate()'의 활동 안에 있습니다. –

답변

0

글라이드 라이브러리의 문제입니다. 글라이드를로드하기 전에 null과 같지 않은 컨텍스트를 확인할 수 있습니다. 또는이를 위해 응용 프로그램 컨텍스트를 사용할 수 있습니다.

Glide.with(getApplicationContext()) 
    .load(imageUrlToLoad) 
    .into(ImageView);