Monthly Archive: July 2011

Android Fragments, Saving State and Screen Rotation

Since the introduction of Loaders in Honeycomb and Compatibility Library, the Android world has changed for the better. However, it took me quite some time to dissect and understand the rather scarce documentation about how to work with these on special cases, like the hated case of screen configuration change – aka […]

Reading text files is damn slow on Android!

In a Android application I wanted to use Scanner class to read a list of floats from a text file (it’s a list of vertex coordinates for OpenGL). Exact code is: Scanner in = new Scanner(new BufferedInputStream(getAssets().open("vertexes.off"))); final float[] vertexes = new float[nrVertexes]; for(int i=0;i vertexes[i] = in.nextFloat(); } It […]

Proper way to add/remove OverlayItems

Some time ago I contributed to an app for Android which had to manage a lot of Google map OverlayItems. The Google API support and performance for overlay items is satisfactory while you have a manageable amount of items but gets messy if you have lots and lots of items. […]