Skip to content

Android Fish (Raw)

This is post will hopefully be the first in a series of posts where I recap something new or interesting that I’ve done in the week before. Since this is the first one, I’ll make it a bonus and include two of them.


I started to mess around with the Android SDK last week.


Messin' around with Android.

For kneejerk impressions, I like how integrated the SDK is with Eclipse. It’s nice being able to do things like download different versions of the API (which corresponds to differing device versions), have a LogCat view (having a provided logger is also nice), manage AVDs, and being able to click run and have it run on my phone for testing.

Speaking of AVDs and testing though, the emulator is slow as hell. Each trial run seems to take forever to start. Even on the phone, it seems to take a while before the Activity actually starts kicking in.

On the other hand, the debugging tools available are nice, being able to look at the logs and stack traces even if I’m testing on a real device.

But, there seem to be some quirks in how the Android works compared to normal Java, especially when the various optimizations are being considered.

For instance, I was trying to iterate through an image and invert the color in its pixels:

for (int x = 0; x < bitmap.getWidth(); x++)
	for (int y = 0; y < bitmap.getHeight(); y++)
		bitmap.setPixel(x, y, bitmap.getPixel(x, y) ^ 0x00FFFFFF);

This code was too slow to actually complete on my device. It turns out though, that this version is much more efficient:

int width = bitmap.getWidth();
int height = bitmap.getHeight();
for (int x = 0; x < width; x++)
	for (int y = 0; y < height; y++)
		bitmap.setPixel(x, y, bitmap.getPixel(x, y) ^ 0x00FFFFFF);

That simple change improved performance enough to allow my device to complete the color inversion. For more reading:


On the lighter side, I tried out this amazing sushi place in San Francisco with my sister called Akiko’s Restaurant

Glorious Sushi


It was delicious. Above is some umimasu and shiro toro. The shiro toro especially kinda just melts in your mouth and makes you happy to be alive and not allergic to fish. It was also delicious.

Posted in Life, Tech.

Tagged with , , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.