My Android App Development Journey (So Far), and Some Guidance for Others

/img/android-app/android-main.jpg

About a year and a half ago I decided that I wanted to try something new. I love learning new skills and I wanted something to focus my mind and give myself a new challenge. I decided the "thing" would be to try and learn to computer program, but where to start? Well I did start and (while I can still remember) I wanted to write down some of the experiences, frustrations and successes of the last year and half, so that I can look back at them, but also to try and help others that might want to start the same journey.

This is my journey from not knowing how to code, to publishing a fully working android application on the Google play store (more info about the app at the website here). I hope you find it useful.

Why computer programming? #

There are a couple of reasons:

I like technical subjects #

I'm an engineer by trade, and this means that I'm generally quite good at technical type subjects that involve logic, problem solving and patience. I would say computer programming falls into this category.

Accessibility #

The other main reason is accessibility. What I mean by this is that, typically, at least in western countries, a computer is already available to most people. The information available on the internet is also extensive, especially with regard to computer programming.

Overall this means that with little to no outlay you can begin, and likely complete, what you set out to do.

Why did you pick Android? #

This was initially one of the sticking points. There are hundreds, if not thousands of programming languages to choose from, and there are new ones coming out all the time. So how do you pick?

My criteria #

I decided the best way to approach it was to set some high level goals:

  1. I must be able to produce something complete by the end (i.e. a complete app or program that I can actually use, not some abstract code)
  2. The tools to build the application or program to completion must be free
  3. It needs to be mainstream enough that I will have enough resources available to successfully learn. Otherwise frustration or boredom (or both) will likely set in
  4. It should be a good representation of current modern programming languages so that I can potentially move forward with other languages at a later date
  5. It should be as self contained as possible. I wanted to avoid any confusion that will likely come from having to get my head around which tools are required to accomplish the job. I wanted to concentrate on learning to code.

Using the above criteria I did some research...

Thinning it out #

The first port of call was potentially web development (i.e. making a website). I threw this out quite quickly as the ecosystem is very complex. It would require the knowledge of HTML, css, php, javascript (and more...) and the tools to deal with these are even more numerous and fast evolving. I needed something more contained...

Laptop with code

It needed to be a program or app. I could therefore pick a platform:

The decision #

...which left Android:

  1. I have many android devices already, so I'm familiar with the platform usage and will have no hardware outlay
  2. Android Studio (the program used to make android apps) is free and self contained. You only need to use that one program, and you can output a complete working app.
  3. It uses only two languages. Java and XML, which keeps it simple. Note: you can also use Kotlin, a new language, but it wasn't available when I started out.
  4. Java is a good representation of a modern language, and one of the most utilised programming languages in the world
  5. There are extensive tutorial videos and websites on how to code in Java AND how to make an Android application. I should therefore be set in terms of learning material

Now I had that out of the way, how to start?

Where did you begin? #

I think this is a good point at which to state my level of knowledge with regard to computer programming before I started.

Mainly through my experience as an Engineer I had some basic knowledge of what a for loop and if statement were through usage within Microsoft Excel VBA macros (don't worry if you have no idea what that is, it doesn't really matter). I didn't write the macros, rather adjusted macros that were automatically generated by excel. We are talking really basic stuff...

If you know what things like strings and ints are then you are way ahead of where I was. If not, don't worry, neither did I!

Learning the basics #

With the above in mind I thought the best place to start would be with Java. Java is the main thing I would be using while writing an android application, so this seemed sensible. I needed to start from the basics. Now I know this was a good choice, as it made following the android tutorials that much easier later on.

Code on screen

I started searching for places I could start to learn Java. Probably the best place to start is with online videos. There are many on youtube, but you can also find some great courses on sites like udemy.

I spent a long time jumping between different courses (some are terrible and hard to follow) and youtube can also be hit and miss, but I am going to make a solid recommendation.

Recommendation #

There is an Australian developer who produces online tutorials called Tim Buchalka. His videos are easily the best I have seen, and as a plus, he has video courses on both Java AND Android development (and Kotlin now too). Both are excellent. They are not free, so this may not be an option for some, which is fine, but if you can spend a small amount then you won't regret it (his Complete Java Development Course is currently EUR 9.99 on udemy just to give you and idea of price). [I also want to make it absolutely clear that I am not affiliated with either Udemy or Tim Buchalka, and receive no kickback from either.

Practise makes perfect #

Whether you decide to go with the video suggestion above or with text books, there is one thing that you absolutely must do, and that is actually write the code yourself.

You can sit for hours reading and watching videos, but it will be no use if you don't actually put it into practice.

You can sit for hours reading and watching videos, but it will be no use if you don't actually put it into practice. I cannot stress this enough, it is essential!

Which software did you use? #

For Android it is easy, you use Android Studio. You can download it for free directly from Google. You will literally never have to use any other software if you don't want to.

Android Studio

Other useful software #

It is however useful when you are learning Java (or Kotlin) to have an interface that is just for Java and not cluttered by all the other things that Android Studio includes (i.e. keep it simple). There are two programs I ended coming back to again and again:

  1. JetBrains IntelliJ IDEA
  2. Sublime Text

SublimeText and Intellij

IntelliJ #

IntelliJ is excellent for writing Java (and Kotlin) code as it is designed for Java development, it is also free to use. The second advantage of IntelliJ is that Android Studio is made by JetBrains, the same company who make IntelliJ, so the interface is very similar. Learning with IntelliJ will help you later with Android Studio.

As an aside, the programming language Kotlin was invented by JetBrains, and is now an officially supported language of Android development. Interestingly, Android Studio will actually convert Java code into Kotlin code for you if you want, as they are similar languages.

Sublime Text #

Sublime Text is almost like an advanced notepad, which is specifically designed for coding. It doesn't look very impressive at first sight, but you will keep coming back to it because it is light and fast. Sublime text has a weird payment model. You can essentially download it from their website, and use it for free forever. However, officially you should buy a licence for "continued use". I would say that if you end up using it extensively then that is fair enough, the developers certainly deserve to get paid!

How did you progress and what were some challenges you faced? #

I will start by saying that programming is a rewarding, but at the same time frustrating process. It has definitely been worth the time, and you will, and should, never stop learning. For want of a better phrase, app development is a bottomless pit of things to learn and master.

First Steps #

As I have mentioned above I started by learning Java. This was very enjoyable, and it's really fun seeing your first lines of code run. The very first program being "Hello World", which seems to be a tradition for programmers as the first code output you ever make.

app development is a bottomless pit of things to learn and master

Then I moved on to trying to understand some concepts of Object Oriented Programming (OOP). This is worth looking at as it underpins a lot of modern languages, and certainly Java. This can take a while to get your head around but is not too bad at a basic level, and ultimately it will help you take advantage of the powerful features the language has to offer.

Android Studio #

Then I decided I was ready to jump into android development. Before you even begin you need to get your head around Android Studio. It is an excellent program, but you will need to learn where everything is, and what the correct naming convention is for files etc. The best way to do this is to follow a video tutorial for a basic app, and then do it yourself in android studio.

Learn from others #

In addition it is a really good idea to take a moment and see how other developers layout their android projects. This you can do by looking at the structure on some GitHub projects (check this article for some links to some GitHub Projects). It allows you to see what convention developers tend to follow:

You can certainly learn a lot from other people's successful projects. This will also help you avoid some pitfalls that you may otherwise have fallen into.

Progression #

At this point I have managed to get android studio up and running, I know some Java, and I can knock together a very, very basic app, and run a test version on my phone. At this point I started the "main" app I had in mind.

two computer screens

Starting with the initial screen I began to build. In my mind I had an image of what I wanted to achieve, but due to lack of experience you come upon a couple of problems:

  1. I had no way to plan ahead properly as I didn't have the knowledge to know what makes the most sense to proceed with first, and I didn't know how to properly structure my code to make life easier later
  2. I realised that some of the ideas in my head, although on the face of it seemed simple, were not necessarily that simple to implement. (Sometimes it can be the reverse! You think it will be hard, and it takes two lines of code, but this is rare.)

The outcome of this is that you will write code, learn, and then re-write the code later when you realise the mistakes you have made, or the inefficiencies in your code. This makes the whole process longer, but it is the best way to learn.

For example, the first problem you will likely hit is that you will write all your code in one big block. Then later you will realise this is terrible as you can't follow your own code, and you will break it into smaller sections or separate files, as it should be. Seeing the problems that large blocks of code causes teaches you why you shouldn't do it. This process repeats multiple times for various different settings

I'm a coding god! #

This is the next stage of the journey. There will come a point when you think "Aha! I get it, this is not so bad now. I think maybe I'm a natural!". It runs well on your phone, it looks like you want (almost)...

Aha! I get it, this is not so bad now. I think maybe I'm a natural!

Not long after, it will dawn on you that you have only scratched the surface. Yes, you can code, but due to your new knowledge you will have a better view of the whole picture, and it is vast. Here is a small selection of the things that popped into view once I stepped back a little and reviewed what I had achieved so far:

  1. Is your code backed up on something like Git (What is Git??!!)
  2. Have you properly tested your code with things like unit tests or similar (What?!!)
  3. Do your resources load efficiently, fast and not on the main thread (That sounds complicated!)
  4. Do you have any memory leaks (How do I even look for that?)
  5. Is your code structured in a way that is easily expandable and readable (to me yes...but others maybe not)
  6. Does it run without crashing on just your phone and android version, or ALL phones and android versions (hmmm...)
  7. Is your code using the correct method of implementation for a particular task, or is it just a hack of inefficient methods because that's all you know at the moment (...more code review then)

Ok, I'm not a coding god... #

My point is that you will never know everything, the subject is huge. If you think you do then you are not trying hard enough, or you are doing it wrong! As I now know, even large companies like Google with their thousands of well paid software engineers do not have perfect bug free code. I know this because I have personally had to work around various bugs in Google's code while making this app.

even large companies like Google with their thousands of well paid software engineers do not have perfect bug free code

A really good resource for any questions you have about android, java or any other coding is StackOverflow forum. I literally wouldn't have a working app without that forum. It is a goldmine of information.

Then one day I asked myself...

What about user login and data backup and sync? #

Ah such a simple question, but what a can of worms.

Can of worms

The thing is by this point I was fairly committed to the app, so I wanted to do it properly. I wanted to be able to record my data in the app, have it sync across devices, and be backed up.

You can use various services to do this for you that will make the interface simpler...but you will pay eventually, as it is initially free to entice you in, and then the costs quickly ramp up with usage. You will also be locked into their system. I wanted to avoid that. Which left me with one option. My own server.

Getting a server #

I signed up for a Linode VPS (which I thoroughly recommend) for $5 a month and got cracking. I managed to build a Linux Ubuntu server. This also had the advantage of allowing me to setup my own emails, and an associated website so I could explain how the app worked (yet more work I hadn't planned for). I then created a REST API using Django Rest Framework (essentially a communication protocol between the app and the server).

Linode logo

Again, this took time to research and implement. I had done none of this before, and in the process I had to learn a new language called Python (not as bad as it sounds once you know a language like Java to some degree), and how to administer and secure a webserver (this was a little involved, but worth it).

Then I had to get the webserver to communicate with the app! To do this correctly was the biggest challenge to date.

Another recommendation #

I will make another recommendation here. When you are dealing with a REST framework you need a program to test it with. I won't go into the detail here, but one of the most popular is called Postman. However, I found the interface a little clunky, and I found an alternative which is (in my opinion) much better: Insomnia. Give both a try if you like.

One last hurdle #

As I went through the process of making the app, I would often come up with new ideas or changes I wanted to make, but at some point you have to actually release the app!

I therefore decided to draw a line in the sand, make sure the app functioned smoothly and release....then I noticed GDPR.

If you don't know what GDPR is, then I will assume you are a hermit living in a cave, but I'll humour you. It is basically legislation implemented by the EU that affects any "thing" (business, website, app, service etc.) that may be used by an EU citizen in terms of privacy and rights to personal information. Overall this is a good thing for all our internet related futures, but it meant that I had to implement various changes to ensure I was in compliance, as the criteria is very strict.

What didn't help was that the efforts of large companies such as Google were a little half-hearted in relation to helping out developers on their platform adhere to the legislation.

This set me back a good month, if not more. Absolute pain in the ass. Anyway...

Finishing up #

I finally got to the point of release. Here it is if you want to give it a spin, or search for "Wanderfile" on the play store:

Get it on Google Play

Wanderfile Website (Explains how the app works)

It is a really excellent feeling, but it doesn't end there...you need to keep it up to date and promote the app. You are competing with thousands of other apps, and to even get a little bit noticed is a struggle. Don't expect 1000 downloads on your first day (or week, or month for that matter).

wanderfile logo

I have no idea if the app I made will succeed or not. It certainly won't be the next Facebook, but that was never the intention.

What I achieved #

I created what I wanted to use, but more importantly, I learnt a huge amount. I can now, at least to some degree:

I would never have thought I would get this far, and certainly didn't expect to get involved in so many areas. It was, in the end, consistent hard work in my spare time. Occasionally it felt like a chore, but generally it was a series of little rewards, with a large reward at the end.

The worst that could happen is you will learn something.

If you think you might enjoy coding I would encourage you to give it a look, and try. It is free, accessible and very rewarding. Plus you will learn things that are applicable to a whole host of fields. The worst that could happen is you will learn something.

Would you change anything looking back? #

Nothing. Honestly. I messed up plenty, but it is all part of the learning process. Now I know things I didn't even have the first clue about before.

What are you going to do now? #

Now I will do my best to keep the app up to date and add new features. I will blog a little here and there, and I will try to think of the next app I could potentially make.

Next challenge basically!

This article is already too long, but I could write forever detailing exactly what I did and didn't do. With that in mind, if you have any questions that you would like to ask either send me an email and ping me a message on twitter and I'll be happy to give you some insight.

🙏🙏🙏

Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated. For feedback, please ping me on Twitter.

...or if you want fuel my next article, you could always:

Buy Me a Coffee at ko-fi.com

Published