Writing an Android App…For Beginners!

A fortnight ago I decided to see if I could learn how to write an Android app…and yesterday I finished and published it (see it here and on the daydrop page, above)!  Given the steep leaning curve, I thought I’d write down the most important “things to know”, in case it’s helpful to anyone else thinking of writing their own app.


I already had some experience of coding, most recently in writing a web app using HTML, PHP and MySQL.  These three are not needed at all to write an app, but the underlying principles of how to write any code are.  Your learning curve will be even steeper if you’ve never coded at all before.

Android Studio

Android apps are a bundle of code (function) and resources (appearance).  You write the code and create the resources, but the whole thing is logistically coordinated by a free “software development kit” (SDK) from Google, called Android Studio.  (You’ll need to download and install this, following the instructions here.)   You write all your code within the Android Studio application, together with the designs for all of the different screen displays of your app, and you also store all of your resources (e.g. graphics) within its folder structure.  Android Studio will help you to test your app throughout your writing and, when you’ve finished it, will collect it all together into an “Android Package” file (.apk) which is what you upload to Google Play when you publish your app.

When you first Open Android Studio, it looks horrendously complicated. However, you only need to focus on a few key areas of the folder tree that it shows you:

  • the “Manifest” lists all of the the things your app can do and needs;
  • the “Java” files are your code;
  • the “layout” files are what your screen looks like;
  • the “menu” files are for the Android Action Bar drop down menus;
  • the “drawables” and “mipmap” folders hold your graphics;
  • “values” hold your styles/sizes (font sizes, colours, etc) and your user-visible text (the words on any screen).

Note the separation of all these differnt aspects.  This modularity allows you to very easily change what your screen looks like on a small-screen phone compared to a 10″ tablet, or to translate your app from English into Spanish, while not having to rewrite your code or publish different versions of the app.  You just provide alternative resources for different situations and Android takes care of the rest.  It’s a very good set up.

Programming languages

Your functional code is written in a programming language called Java, which is one of the most prevalent programming languages used in the world today.  (It has no connection at all to JavaScript, don’t muddle them up!)  Java is “object-oriented”, which takes some getting your head around if you’ve never experienced  the format before.  I found this book quite helpful in that regard, although it only covers Java generically and doesn’t include anything about the hundreds of Android-specific “classes” and “methods” on which your code will depend.  Note  that the Java coding software (JDK) is different to the Java running software (JRE).  You probably already have the latter installed on your computer (your web browser needs it) but you will have to install the former as part of the installation of Android Studio.

Your layouts are written in XML, which is tag-based, like HTML.  I didn’t use a book for that, as it is much more intuitive.

For both, my greatest resource has been the StackOverflow website.  Google whatever it is you’re stuck on and then read all of the answers from that website!  I haven’t yet read anything anywhere near as useful on any other website at all.

App basics

Every screen your app’s user sees is called an “activity”. Every activity stands alone – it has its own Java code, it’s own layout, it’s own menus (although you can reuse layouts and menus if you really want to). To switch to another activity, the Java code of the current activity sends a message (called an “intent”) to the Android system requesting that the system starts the new activity.  The fact that it is the Adroid system that is in ultimate control, and not your app, is one of the powers of Android: because you can request to start an activity from a completely different app, or you can allow other apps to start any one of your activities.  For instance, one of my activities starts the “capture video” activity of the device’s camera app, before coming back when it is finished.

In the absence of an intent to start a new activity, the Java code of the current activity sits and “listens” for events, like button presses, etc, and you write into your code all the different things it should do when those events happen.


You’ll do this constantly as you go, by pressing the “run” button inside Android Studio.  It is a lot easier to do on a real device (connected by USB cable), but Android Studio also provides dozens of emulated devices as well (although these do tend to run a little slow, I have found).


And that’s the “making”.  To publish it on Google Play, you’ll need a Google account, on which you’ll need to activate Google Wallet if you want to sell your app for money.  You then pay Google a one-off $25 (£16) fee, upload some artwork, screen shots and explanatory text and hit the “publish” button.

Then try your best to spread the word.  🙂