check if fragment is attached in fragment asynctasks
This commit is contained in:
parent
cc3be7ed43
commit
ac3dbd593a
@ -144,6 +144,8 @@ public class ArticlePager extends Fragment {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JsonElement result) {
|
||||
if (isDetached()) return;
|
||||
|
||||
m_activity.setProgressBarVisibility(false);
|
||||
|
||||
super.onPostExecute(result);
|
||||
|
@ -255,6 +255,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JsonElement result) {
|
||||
if (isDetached()) return;
|
||||
|
||||
m_activity.setProgressBarVisibility(false);
|
||||
|
||||
if (result != null) {
|
||||
|
@ -343,6 +343,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
|
||||
ApiRequest req = new ApiRequest(getActivity().getApplicationContext()) {
|
||||
protected void onPostExecute(JsonElement result) {
|
||||
if (isDetached()) return;
|
||||
|
||||
if (result != null) {
|
||||
|
||||
try {
|
||||
@ -399,6 +401,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JsonElement result) {
|
||||
if (isDetached()) return;
|
||||
|
||||
m_activity.setProgressBarVisibility(false);
|
||||
|
||||
if (result != null) {
|
||||
@ -632,6 +636,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
}
|
||||
|
||||
protected void onPostExecute(Integer result) {
|
||||
if (isDetached()) return;
|
||||
|
||||
m_adapter.notifyDataSetInvalidated();
|
||||
}
|
||||
|
||||
|
@ -368,6 +368,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(JsonElement result) {
|
||||
if (isDetached()) return;
|
||||
|
||||
m_activity.setProgressBarVisibility(false);
|
||||
|
||||
super.onPostExecute(result);
|
||||
|
@ -545,7 +545,9 @@ public class OnlineActivity extends CommonActivity {
|
||||
|
||||
ApiRequest req = new ApiRequest(getApplicationContext()) {
|
||||
protected void onPostExecute(JsonElement result) {
|
||||
hf.refresh(false);
|
||||
if (hf.isAdded()) {
|
||||
hf.refresh(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user