异步任务结束操作,对于ativity fragment SharedPreferences等涉及到context操作前的判断
if (Ativity.this == null || Ativity.this.isFinishing()) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (Ativity.this.isDestroyed()) {
return;
}
}
if (Fragment.this.getAtivity() == null || Fragment.this.getAtivity().isFinishing()) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {//api 16+
if (Fragment.this.getAtivity().this.isDestroyed()) {
return;
}
}