'Context finish check'에 해당되는 글 1건

  1. 2019.06.16 [Android] Context removed error when activity destroyed
2019.06.16 22:59


Context is removed when activity called onDestroy().

So when after called context, It goes to error.

So please reference next solution code.

 

# Example Resolution Code

if ( context instanceof Activity ) {
    Activity activity = (Activity)context;
    if ( activity.isFinishing() ) {
        return;
    }
}
Toast.makeText(context, "I'll do things here that depend on my context and views being valid", Toast.LENGTH_SHORT).show();

 

 

#Reference Link

https://stackoverflow.com/questions/7856103/how-can-i-tell-if-my-context-is-still-valid



Posted by injunech