I recently got this error in a crash report from the android market for my app.
The problem was that I was trying to load many bitmaps into a gridview (thus causing the app to run out of memory). The problem became quite noticeable at around 20 bitmaps and over.
I was trying to fix the problem with all kinds of silly band-aid solutions (eg calling the garbage collector in getView of the adapter, yikes!)
I managed to identify the root cause of the problem: I wasn't scaling the images in the BitmapFactory.
I was doing this:
BitmapFactory factory = new BitmapFactory();
Bitmap img = factory.decodeFile(path);
when I should have been doing this:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
options.outHeight = HEIGHT;
options.outWidth = WIDTH;
BitmapFactory factory = new BitmapFactory();
Bitmap img = factory.decodeFile(path,options);
After 30 seconds of vigorous scrolling of the gridview, I think I have solved it. Or maybe not, feel free to try out my app and let me know if it crashes again:
https://market.android.com/details?id=remember.me
I hope that helps.
Saturday, September 24, 2011
Tuesday, August 30, 2011
I finally did it!
Today I published my first Android app!
Check it out and send me bug reports!
https://market.android.com/details?id=remember.me
supports version 2.1+
Tested on HTC Magic with Sense UI
Check it out and send me bug reports!
https://market.android.com/details?id=remember.me
supports version 2.1+
Tested on HTC Magic with Sense UI
Monday, May 2, 2011
War Profiteering 101
War Profiteering 101:
Step 1: Find shady Middle Eastern dude
Step 2: Give shady Middle Eastern dude weapons
Step 3: Use shady Middle Eastern dude as scapegoat
Step 4: Bomb Middle East
Step 5: Profit!
Step 6: Declare victory
Step 7: Kill shady Middle Eastern dude. He is no longer needed.
Step 8: Repeat step 1
Step 1: Find shady Middle Eastern dude
Step 2: Give shady Middle Eastern dude weapons
Step 3: Use shady Middle Eastern dude as scapegoat
Step 4: Bomb Middle East
Step 5: Profit!
Step 6: Declare victory
Step 7: Kill shady Middle Eastern dude. He is no longer needed.
Step 8: Repeat step 1
Saturday, April 9, 2011
The end of the new theme
This will be my last post for cmpt 376 and I want to reflect on the last 25 posts in this blog. Initially I had hoped to write some intelligent and worthwhile posts, but my laziness got the better of me. I'm not saying that I didn't put any thought into it, but the well thought out posts were not as frequent as I had hoped. even so, I'm still happy that this blog actually had a legitimate purpose for once (5%). I guess it's now time to go back to our irregularly scheduled programming of profanity, Bible verses and anti-Americanism.
Thursday, March 31, 2011
11 days left and Ubuntu stuff
Next week is the last week of class, and there is one assignment due for each class. At this point, I'm honestly just looking to get it over with.
On a completely unrelated not, Ubuntu 11.04 Beta 1 was released today. Once I stop being lazy, I will read up about it and maybe post my opinion here. I am looking forward to this version of Ubuntu because it will be running on the 2.6.38 kernel and from what I've read, it will result in a noticeable leap in performance. I'm still not a fan of Unity, and after running the Macbuntu theme since Christmas, I don't want to go back to standard Gnome. I'm hoping the Macbuntu developers release an 11.04 version soon after the OS gets released.
On a completely unrelated not, Ubuntu 11.04 Beta 1 was released today. Once I stop being lazy, I will read up about it and maybe post my opinion here. I am looking forward to this version of Ubuntu because it will be running on the 2.6.38 kernel and from what I've read, it will result in a noticeable leap in performance. I'm still not a fan of Unity, and after running the Macbuntu theme since Christmas, I don't want to go back to standard Gnome. I'm hoping the Macbuntu developers release an 11.04 version soon after the OS gets released.
Sunday, March 20, 2011
Shaw bandwidth caps
With this whole UBB debate still raging on (not in the news), you may be curious to find out how much bandwidth you are using. If you are a Shaw customer, head over to secure.shaw.ca and sign up for an account. From there, you can see your monthly bill as well as a nice bar graph of your monthly usage. I am currently at 59.xxGB for March, with 12 days until April 1st. Let's hope I don't get any angry emails.
Saturday, March 12, 2011
30 days left
There are 30 days left in the spring 2011 semester and I seriously need to stop slacking. This week I have three assignments due. I really should start doing them, but the force of procrastination is strong. I also need to look into doing more job applications for summer co-op, but I feel quite lazy. I think I might have burned myself out last semester. It will e a shame if my GPA drops after this semester.
On the up side, I'm almost done with this blogging business...
On the up side, I'm almost done with this blogging business...
Subscribe to:
Posts (Atom)