Android-keyboardview-example is a project mainly written in Java, it's free.
This is a simple example of how using KeyboardView for creating a custom keyboard on Android. You can find a tutorial (in Italian) based on this code at:
http://www.anddev.it/index.php/topic,3956.0.html