Skip to content

Commit

Permalink
Don't use Activity.isDestroyed(), it's not available until API Level 17
Browse files Browse the repository at this point in the history
  • Loading branch information
itkach committed Jan 6, 2015
1 parent 08b1d5d commit 1de6408
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/itkach/aard2/ArticleCollectionActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public Blob convert(Object item) {
};



private boolean onDestroyCalled = false;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -108,7 +108,7 @@ else if (action.equals("showHistory")) {

@Override
protected void onPostExecute(ArticleCollectionPagerAdapter adapter) {
if (isFinishing() || isDestroyed()) {
if (isFinishing() || onDestroyCalled) {
return;
}
articleCollectionPagerAdapter = adapter;
Expand Down Expand Up @@ -263,6 +263,7 @@ private void updateTitle(int position) {

@Override
protected void onDestroy() {
onDestroyCalled = true;
if (viewPager != null) {
viewPager.setAdapter(null);
}
Expand Down

0 comments on commit 1de6408

Please sign in to comment.