Skip to content

Commit

Permalink
issue #1 Use bitmap.recycle() for better memory use
Browse files Browse the repository at this point in the history
  • Loading branch information
jarofgreen committed Jul 7, 2013
1 parent 4b55ede commit 451a378
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/uk/co/jarofgreen/shakefromgallery/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class MainActivity extends Activity {
ImageView mainImageView;
Random randomGenerator;
TextView mainTextView;
Bitmap bit;

ShakeDetectActivity shakeDetectActivity;

Expand Down Expand Up @@ -152,7 +153,10 @@ public void nextPicture() {
lastTriggersSelected.add(Integer.valueOf(next));
if (lastTriggersSelected.size() > remmeberLastImages) lastTriggersSelected.remove(0);

Bitmap bit = BitmapFactory.decodeFile(images.get(next));
if (bit != null) {
bit.recycle();
}
bit = BitmapFactory.decodeFile(images.get(next));
mainImageView.setImageBitmap(bit);

}
Expand Down

0 comments on commit 451a378

Please sign in to comment.