Skip to content

{ Category Archives } Uncategorized

Nexus One display: 16 or 24 bits per pixel?

There has been some discussion recently about whether the Nexus One display panel hardware has 24 bits per pixel or 16 bits per pixel. 24bpp means 8 bits per color RGB888 and allows a total of about 16 million different colors. 16bpp is RGB565 (Red and Blue have 5 bits and Green has 6 bits), [...]

Android: OpenGL ES screenshot

Here is how you can get a .png screenshot of an OpenGL image on Android: // GL10 gl; // int width, height; int size = width * height; ByteBuffer buf = ByteBuffer.allocateDirect(size * 4); buf.order(ByteOrder.nativeOrder()); gl.glReadPixels(0, 0, width, height, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, buf); int data[] = new int[size]; buf.asIntBuffer().get(data); buf = null; Bitmap bitmap = Bitmap.createBitmap(width, [...]

Android application backwards compatibility

Say you are an Android application developer. You have a last-generation Nexus or Droid phone, and you use for development a recent Android SDK version 2.1. Yet more than a half of your potential users have older phones with older versions of Android: 1.5 (Cupcake) or 1.6 (Donut). You can simply ignore the not-up-to-date user [...]

The free AppEngine: how much does it cost?

AppEngine is a Google product that allows to write web applications in Python or Java and host them on the Google infrastructure. AppEngine takes care of the typically difficult tasks of distribution, scalability and fail-over. It offers easy to use APIs for web request handling, data storage, memcache, etc. One of the biggest benefits is [...]

Nexus One display and subpixel pattern

According to the Nexus One specs, it has a 800×480 AMOLED display. According to Wikipedia, this is what makes an AMOLED display different from standard LCD: It does not need a backlight, the pixels emit light themselves. This allows for thinner display. Only the turned-on pixels consume power. In average AMOLED uses less power than [...]

Android package name

There are two independent notions of “package” in Android. One is the usual Java package, which is how the Java classes are organized inside your project. The other is the Application package, which is an unique application identifier used by Android to manage the installed applications. The two package names are completely independent and serve [...]

Android: allocation-free code avoids the GC freeze

When a Java program creates new objects (using new), it results in the subsequent invocation of the Garbage Collector to free up memory. On Android an invocation of the GC takes of an order of 100ms, so it produces a user-visible short freeze of the application. Especially when the application is doing some form of [...]

Android Proguard with useful stack-traces

As I said in my previous post about using Proguard with Android apps, the only drawback is that the stack-traces (following an application crash) become illegible. But that is not entirely true because Proguard allows you to shrink while maintaining useful stack-traces. After this finding, there isn’t really any drawback to using Proguard anymore! The [...]

Kreactive calculator uses the Arity library in disguise

I installed today the Kreactive Calculator from the Android Market and I realized that it uses my Arity library. As I released Arity under the Apache 2.0 License (a very permissive license), a new user of the library is usually good news. But Kreactive does not seem to be a good open-source citizen: they repackaged [...]

Android and Proguard, the shrink recipe

Proguard is a Java shrinker and obfuscator. It reads java .jar files and writes them back with a significantly smaller size. This is achieved by various optimizations, elimination of unused code, and renaming of classes, methods and members to shorter (1-letter) names. Proguard is a good and very useful tool for general Java projects. What [...]