- Update Site: http://download.eclipse.org/mat/1.5/update-site/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
void
updateContentAndRecycleBitmap(
int
category,
int
position) {
if
(mCurrentActionMode !=
null
) {
mCurrentActionMode.finish();
}
// Get the bitmap that needs to be drawn and update the ImageView.
// Check if the Bitmap is already in the cache
String bitmapId =
""
+ category +
"."
+ position;
mBitmap = sBitmapCache.get(bitmapId);
if
(mBitmap ==
null
) {
// It's not in the cache, so load the Bitmap and add it to the cache.
// DANGER! We add items to this cache without ever removing any.
mBitmap = Directory.getCategory(category).getEntry(position)
.getBitmap(getResources());
sBitmapCache.put(bitmapId, mBitmap);
}
((ImageView) getView().findViewById(R.id.image)).setImageBitmap(mBitmap);
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
void
updateContentAndRecycleBitmap(
int
category,
int
position) {
mCategory = category;
mCurPosition = position;
if
(mCurrentActionMode !=
null
) {
mCurrentActionMode.finish();
}
if
(mBitmap !=
null
) {
// This is an advanced call and should be used if you
// are working with a lot of bitmaps. The bitmap is dead
// after this call.
mBitmap.recycle();
}
// Get the bitmap that needs to be drawn and update the ImageView
mBitmap = Directory.getCategory(category).getEntry(position)
.getBitmap(getResources());
((ImageView) getView().findViewById(R.id.image)).setImageBitmap(mBitmap);
}
|