Category Archives: Android

Do not use numbers or underscores as first characters in Android/Java package names

Well, I’ve been trying different things out at work the last week in order to make some small tests and evaluating different design ideas – I can’t reveal what it’s all about yet, except I could mention some buzz words that doesn’t really say anything (scalability, cross-X, open source, market killer, etc. etc. etc. some of these might be true, some might be wishes and some might just be pure imagination).

Anyway as part of this I have been writing a number of small Android applications – and guess what, I learned the hard way that you can’t use _ (Underscores) or numbers as the first character  like systems.mikek.oneforall is ok, but systems.mikek.1forall isn’t – which might make sense, as numbers are not allowed as the first character in identifiers in many languages (even they are fine for URL’s) – but I was a bit more surprised that prefixing the number with _ wasn’t allowed either – so no systems.mikek._1forall either…  lesson learned 🙂

^__^
Mike

btw. I don’t know if this is just for Android, or generic for Java (actually I only tried it in an app made in the Qt5 framework for Android).

Link to great page about writing Android plugins for Apache Cordova (aka PhoneGab)

Apache Cordova is a tool/library/… for writing cross platform (mobile) applications.  With Cordova you write the code in HTML5, CSS and JS like you would on a homepage, just packed into an application that can run on many different platforms.

But Cordova is more than just that, it also has a number of plug-ins that makes it possible to access systems on the platforms that a normal web application can’t access.  It is even possible to make your own plug-ins.  The plug-ins are typically written in the native language for the platform, like Java for Android, C# for Windows Phone etc.

Unfortunately the “official” Cordova documentation for writing plug-ins are…hmm…aeee… let’s just say, I couldn’t figure it out, but thanks to Google I found this blog post that describes how to write plug-ins in Java for Android.

^__^
Mike