Nat! bio photo

Nat!

Senior Mull

Twitter Github Twitch

Android, SVG and Java Rant

I figured I could be spending the rest of my live in bliss, neither having to write in C# or Java ever again.

WRONG!

Because of the cheapness of android tablets, I can now for the first time create small, simple programs and give them away for christmas to hapless children of my family complete with the hardware. All for EUR 80.

It would be really, really cool if those tablets would be conveniently rootable. They aren't though :( I hope RMS gets onto this.

But, android needs to be programmed in Java. Probably my pet-hated language, C++ being a close second. Human memory being what it is, I thought that it wouldn't be cool, but that it probably would just work.

WRONG!

One of the things always touted about Java is, how convenient the garbage collection is and that one doesn't have to worry about memory management. Which even I remember, isn't true, because in the end most of the time in Java projects is spent hunting down leaks. So  explicit management of the object tree always was necessary. And I hated every second of it. I hated writing it and I hated debugging it. Oh god, the memories are coming back now...

As a little aside, I experimented loading Drawables from inkscape generated SVG with svg-android and svg-android-2. Forget about it. The parsing is javaesque snail paced and most of the time the inkscape SVG can't be parsed by these libraries anyway. I tried simplifying them with scour but that had some side-effects on the gradients, which I didn't like (maybe a precision thing). So I didn't go down that route further.

Anway. So of all the problems, that probably exist in android, I immediately run into this http://code.google.com/p/android/issues/detail?id=8488. I don't know how many other glaring bugs android has, but this is just the typical resource unaware Java lameness.  And this bug is most likely in there from the beginning of android.

I especially love how the first mail is from a guy, who claims to have written parts of the UI graphics code, who is totally oblivious to the fact, that a problem exists and then never shows up in the discussion afterwards. Bug Status ? Declined. There is no bug, because that's normal sucky Java behavior!

What is the folksy workaround ? Use some other crufty Java classes which allow manual management. The other idea, and I suspect a LOT of android is written this way: keep the Java as OS-glue and go native for the real action.