Properly destroy background loader in onDestroy().
Change-Id: I6069262f9ebb46d01f15ca64332ce600db2f899c
This commit is contained in:
@@ -45,7 +45,6 @@ public class WallpaperChooser extends Activity implements AdapterView.OnItemSele
|
|||||||
private ImageView mImageView;
|
private ImageView mImageView;
|
||||||
private boolean mIsWallpaperSet;
|
private boolean mIsWallpaperSet;
|
||||||
|
|
||||||
private BitmapFactory.Options mOptions;
|
|
||||||
private Bitmap mBitmap;
|
private Bitmap mBitmap;
|
||||||
|
|
||||||
private ArrayList<Integer> mThumbs;
|
private ArrayList<Integer> mThumbs;
|
||||||
@@ -104,6 +103,16 @@ public class WallpaperChooser extends Activity implements AdapterView.OnItemSele
|
|||||||
mIsWallpaperSet = false;
|
mIsWallpaperSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
if (mLoader != null && mLoader.getStatus() != WallpaperLoader.Status.FINISHED) {
|
||||||
|
mLoader.cancel(true);
|
||||||
|
mLoader = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onItemSelected(AdapterView parent, View v, int position, long id) {
|
public void onItemSelected(AdapterView parent, View v, int position, long id) {
|
||||||
if (mLoader != null && mLoader.getStatus() != WallpaperLoader.Status.FINISHED) {
|
if (mLoader != null && mLoader.getStatus() != WallpaperLoader.Status.FINISHED) {
|
||||||
mLoader.cancel(true);
|
mLoader.cancel(true);
|
||||||
@@ -199,6 +208,10 @@ public class WallpaperChooser extends Activity implements AdapterView.OnItemSele
|
|||||||
drawable.setDither(true);
|
drawable.setDither(true);
|
||||||
|
|
||||||
view.postInvalidate();
|
view.postInvalidate();
|
||||||
|
|
||||||
|
mLoader = null;
|
||||||
|
} else {
|
||||||
|
b.recycle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user