Programming Languages in Android

The first question for an aspiring Android programmer is certainly

“What programming language should I learn to program in Android”?

The answer is less simple than any impatient programmer would like to listen: Android runs on every type of device, from the obvious mobile phones to watches, tablets, cars, televisions, home security systems and many more.

This variety of targets can be achieved only at the cost of separating tasks, in particular separating everything that is related to the user inteface from the logic of the application: this way what is the “juice” of your program stays more or less the same, while the appearance can fit different screens and different expectactions.

So there isn’t only “one” language to program in Android, but a few different languages to achieve different purposes. You don’t need to master everything at perfection to get started, but if you want to have an easier life (mind: easier doesn’t mean easy) as a developer, you certainly need to grasp something of all of them.

I will list them in three sections:

the core, i.e languages to manage the logic of your programs

the appearance, to manage the app UI.

the useful extras: languages to manage specific parts of a program, that you may or may not want to learn in depth, at first.

The core: Java and Kotlin


Until the Google I/O of May 2017, when Google announced the support to Kotlinjava as first class and fully supported programming language for Android, Java would have been your only cup of coffee to pick for this section.

Now the things are slightly changed, but nonetheless Java remains a “must have” for any Android programmer: most, if not all, the documentation for Android is in Java, most of all non-native libraries for Android are in Java, the source code is in Java, 99.9% of books about Android are in java, most of the tutorials on the web are in Java.

Java is a statically typed, object-oriented, super-verbose programming language, the type of programming language that comes with tons of curly braces and semicolons.

Java compiles bytecode that can be then read by the target devices running a Java Virtual Machine. So you write your code once and then it can run everywhere a java virtual machine is or, as someone says, “write it once, debug everywhere”.

The portability of Java across many devices is the main reasons it was picked as main language for Android.

Created by James Gosling, launched by Sun Microsystems in 1995, Java is under the control or Oracle Coporation since 2009.

So, can you skip learning Java? I think that for a few years the answer is no, because you would have a very hard time at trying to learn, program and debug Android without understing what most of programmers have written about it, even if in the end you want to program in Kotlin.

I understand your feelings, if you come from something more friendly and less verbose than Java (almost everything modern), but look at the bright side: it’s the most popular language out there, you won’t be alone.

Mind: everything changes and Kotlin has a few features that can undermine Java in the long run.

You can learn more about Java here.


kotlin_android3Kotlin is the new kid on the block: it’s concise, it’s elegant , it promises a world without Null Pointer Exceptions unless you want to throw them explicitly (maybe because you are a nostalgic javista and it reminds of your youth).

As stated on the Kotlin official web page, it is 100% interoperable with Java and Android, in fact, in the context of Java and Android, Kotlin runs on the Java Virtual Machine exactly like Java, hence its compatibility and the possibility to use Kotlin along with the existing libraries for Java and Android.

So what does change with Kotlin? It is designed to write less lines of code and leverage immutability and limit nullability, so in short “less errors”.

It seems Kotlin is quite similar to Swift, so maybe it could be a good choice for IOS developers courious to give a try to Android.

Kotlin will be shipped with Android Studio (the Android official IDE) starting with the release 3.0, now in beta, but it can also be installed as plugin in recent versions of the stable version of Android Studio.

Kotlin is developed by Jetbrains, the famous IDE-for-everything company, the same that produce Android Studio, by a team based in Saint Petersburg: the name of the programming language derives indeed from an island of the same name off the city.

More resources on Kotlin:
Kotlin and Android
FAQ on Kotlin and Android
Resources to learn Kotlin


The appearance: XML

xmlAll the layouts, images, menus and various views forming the UI of a common android app, are defined in XML files. Every of them it’s an xml element with attributes to tweak its appearance.

Not only strictly graphic elements are defined in XML, but everything that can change the appearance of the app, so also strings that can vary according to the language of the user: in Android you can easily configure an app to use entirily different sets of strings for English and, for example, Italian or Japanese, simply providing them in the app resources in the appropriate folder.

Furthermore, XML files are used to store resources like dimensions, colours, styles of graphic elements and so on: the possibility of customizations based on devices, language, screen sizes, orientations of the screen and so on are infinite.

XML is very similar to HTML and probably very easy for most of experienced developers, but also beginners shouldn’t be too scared of it.

The only thing that it is sometime difficult, it’s to find the list of values that a single attribute of an XLM element in android can have: this is sometimes a matter of googling and looking on stack overflow rather than looking at the documentation.


The useful extras: Gradle DSL (a.k.a Gradle version of Groovy), SQLite

Gradle DSL (Groovy)

GradleLogoRegAndroid Studio, the official and free Android IDE provided by Google, uses Gradle, a tool to manage builds and libraries used in a Android app.

Gradle applies plugins (first of all the Android pluging), ties your code to your libraries and signs digitally your app, so everything can be nicely packed in an APK and shipped to the app market of your choice (most probably Google Play).

Most of the files an Adroid beginner finds unsettling and mysterious are indeed gradle files, written in a language called Gradle Domain Specific Language or in short Gradle DSL. Gradle DSL is a version of Groovy a scripting language that can interoperate with Java.

The most common operations on the build.gradle files consists in adding dependencies to libraries and providing the repositories to download them: it’s something easy even for a beginner, but to grasp what Gradle is really doing it is worth to learn something more about it.

Gradle can configure different builds for different versions of an app (example: a free and a paid version of an app) that require different libraries or different resources and portions of code. Gradle can help yout to maintain “slim” the size of your app.

You can learn more about Gradle DSL here
or if you want a friendly introduction that can help you understand the principles of Gradle and a bit of Groovy quite quickly, I recommend this course from Udacity:
Gradle for Android and Java


sqlite2Content Providers are part of the main components of the Android os. A Content Provider sits between your data and your code and tipically you use it to access data in databases. For reasons of security and modularity, you don’t want to call methods on your database directly from your code, but you call this component provided to you by Android, the Content Provider, and it in turn calls your database executing only a set of predetermined actions, so your data remain safe and sound.

If one day you want to change entirely your database, switching to something fancier, you don’t need to change your java (or kotlin) code, because the Content Provider will call always the same methods.

In theory you can use the type of databae you prefer, but Android provides you with helper classes that are meant to use SQLite.
SQLite is very light (and quite fast), so it doesn’t add too much weight to your app.
Not every programmer implements a database from scratch, many developers use ready-to-use libraries that are easier to manage, but in case you want to use only pure Android, it is worth to learn a bit of SQLite and it certainly required if you want to take the Associate Android Developer certification.

Don’t be scared of this list, and above all, don’t be scared at your first look at Android Studio: even the more simple app, it’s a little city of files, but with a bit of time you will become more familiar with it and every piece will find its right place.
There are always two ways to find your path, through your Android probems: Google and Stack Overflow, nobody can survive without them
, you are not alone.






Google launches the Associate Android Developer Certification

Like many other giants of software, Google has decided to offer an official certification to allow programmers to show proficiency in one of its most popular technology platforms: Android.
In order to obtain the Associate Android Developer Certification, the aspiring
associate must take an exam that is offered after the payment of a fee (at the moment offered as launch promotion at 99$, but in the future it will cost 149$).

The exam is offered only in English and has two steps: in the first the applicant receives a starter project that has some bugs to fix and to which add some required functionalities. The project must be completed in 48 hours and is designed to cover five basic topics:

-Testing and Debugging:

i.e: Writing JVM unit test and UI tests, replicate a failure, use system log to debug, fix an application crash, debug and fix activity lifecycles problems and problems in binding data to views.

-Application User Interface (UI) and User Experience (UX)

i.e: creating a custom View class, implement a RecyclerView, localize an application, add accesibility hooks to a custom view, etc.

-Fundamental Application Components (Activity, Service, BroadcastReceiver and Content Provider)

i.e: use a JobScheduler to set a background task, propagate data changes to the UI with a Loader, create an Activity that displays a layot resource, etc.

-Persistent Data Storage

i.e: create a database, use a ContentProvider, etc.

-Enhanced System Integration

i.e: create Widget that can interact with the user outside the application.

The exam must be submitted in 48 hours, accompanied by a PDF copy of some form of official government-issued ID (like passports, driver license, etc): it will be graded partially by machine and partially by humans.

If the exam is passed, the applicant will be interviewed in person: due to the international composition of the android developers, I suppose the interview will happen through the internet, but this isn’t explicitly defined in the official documentation.

The entire process, from the exam to the interview should take no more than 45 days.

If an applicant fails the first step, he/she can retake the exam immediately a second time, if he/she fails again ,the exam can be retaken a third time after 2 months (both times without repaying the fee).

If our applicant is so unlucky to fail even the third attempt, he/she must wait six months before retrying, but this time paying the fee again.

The Associate Android Developer Certification isn’t a lifetime warranty, it has an expiration date: it lasts 3 years, after that time, the exam must be retaken.

In order to help aspiring developers to brush up their knowledge Google has partnered with Udacity (for online courses about Android) and with General Assembly (for in-person courses).

Udacity, in particular, has launched a new Associate Android Developer Fast Track and according to the Android Developers Blog has renewed one of its most famous courses, “Developing Android Apps” to keep up with the most recent changes in the Android Platform: it now includes topics like Firebase Job Dispatcher and the new Constraint Layout, furthermore the lessons have been restructured to be more friendly for beginners, who can now build smaller example apps about every topic before adding new features in the bigger app “Sunshine” that is built throughout the course.

The Udacity courses can be audit for free (there’s a fee to pay only for the Udacity certification and for some additional services, like help from mentors), so this is a great occasion for aspiring android developers in general and for those who want to prepare for certification as well.

For more informations:

Google Developer Certification

Associate Android Developer Fast Track

Android Developers Blog

Hello World!

“Hello World!”

Are there more appropriate words to start a blog about programming?
Foofology is a blog dedicated to my great passion: coding!
I’m a self-thaught programmer with a dream to become a professional developer.
This blog will host my notes and reflections about programming mostly about java and android, but maybe also  about python (which is my first love) and probably something about the new hot topic of the moment “Big data” and machine learning….
Oh, I’m forgetting that it’s the end of the 2016: it’s a great time for new year’s resolutions, so maybe there will be something about javascript also (it seems javascript is the new black in programming).
I’m writing this blog not to show expertise, but to improve myself: I’ve read many posts by professional developer saying that sharing what they have learned helped them to grasp better the subject and I believe this is true.
I’m italian, not a native English speaker, so this blog is a also a good occasion for me to improve my writing skills in English, but I have in mind to start a twing blog also in my own language in the near future (just to add another element to my stack of new year resolutions).
I confess I also hope to be of some help for someone.
Happy Coding!