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 🙂


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.


Setting up the Raspberry pi for 1-wire access

The entry describes various info on the Raspberry Pi’s 1-Wire interface.

To enable the 1-Wire module (defaults to GPIO4 on the Raspberry run the following from the terminal:

$ sudo modprobe w1-gpio
$ sudo modprobe w1-therm

I guess the first line enables the 1-Wire interface, and the second the automatic reading of the DS18B20 temperature sensor.

As an alternative (if you don’t want to manually enter these every time – which would be very inconvenient in a system that is running unsupervised) you can load these two kernel modules automatically by editing /etc/modules, e.g. “sudo nano /etc/modules” (To save with the Nano editor press Ctrl+O and then press enter to confirm the filename, to quit press Ctrl+x. if you are unable to save, then maybe you forgot the “sudo” at the beginning of the line).

Add/ensure the following two lines can be found in /etc/modules:


Save and close the file, after next reboot the kernel modules will be loaded without intervention.


Sources for the information in this post: