Start is scary; in any field of expertise. Here I am talking about coding… app development mostly. People prefer to take the safe side when there comes the task of developing apps, especially for the first time. Thinking about the hefty amount of work they should put into it ends up making them give up on the whole idea. Building an app is not easy. But it’s not that tough either. So if you ever want to create your first application and you’ve got cold feet, don’t worry any longer. I’ll walk you through the detailed path of bringing your dream project to life. Building an Android application would never again be a frightening task. In fact, once you understand the basics and the steps, you will breeze through the processes and your creativity will see the light.
This is the first of the series on Android app development for beginners.
How to build your first Android program?
First Step: Picking up a toolbox
You can’t really build an application without a toolbox, just like you can’t build a tree-house with a hammer and some nails. For Android app development, you will need the following tools:
- Development Environment
- A programming language
- A code editor and/or a compiler
- A test device.
You need to pick a programming language for the task. Now, here are the options you have:
These are the officially supported languages for Android development by Google. It’s worth mentioning that you can build pretty much any application with any language from that list. They are different in some technicalities that you most probably will not address while building your first application.
- C++/C# are by far the hardest languages to learn. Unless you have prior experience with them, I’d recommend choosing either Java or Kotlin. However, this is only to facilitate your task.
- Kotlin is probably the easiest and the closest to human language. It makes debugging errors very easy and even the code syntax is pretty straight-forward. The only disadvantage is that there are not as many tutorials for Kotlin as there are for Java and C++.
- Java is by far the most widely used language for Android development, so you can begin your journey with it.
A code editor and/or compiler
There are several code editors that can work with Java and help you build and build your apps easily. But before that you need to have Java Development Kit (JDK) preinstalled in your system, followed by Android Software Development Kit. Both are free to install and use, even for commercial purposes. After you are done with these, you can write codes via any of the code editors available and compile them using Javac (java compiler). Android Development Studio (or Android Studio, in short), however, is the best, if you don’t want your editor and compilers to be different and independent. Powered by a strong suit of support and plugins, it can help you get started from Java to pure Android in no-time. Other options include Eclipse, Netbeans, Notepad++ etc. Feel free to try these out in addition to Android Studio and let’s know the experience.
A Test Device
Testing your app on a real device is very important. You can use Android Emulators, especially the one that comes in Android Studio inbuilt but only a real device can show what it feels to have the app in real.
Second Step: The Design
The worst mistake that you could make while making any piece of software is jumping right to the editor. You’ll find yourself staring at a blank page with a programmer-block, just like writers do. Whether you’re a novice or a fully-fledged expert, you need to start with a proper design. Since you’ll be doing all parts of your Android project, there are a few design phases or steps to cover.
Cut the time
There’s a rule of thumb in programming called the 80-20 rule, which states that if you spend 80% more time designing your application you’ll cut the implementation time to 20% time. If it takes 5 days to code, it would then take only 1 if proper design is implemented. It’s pretty big, isn’t it?!
General design is important
First of all, you need to make the general design or a “Business Model“. Of course, we don’t mean a literal Business model, but something to define the purpose of the application, specify the users and functions and so on. When you get that done, you need to start making the use cases. Use cases are usually simple; short sentences that state how an action flows. For example:
- “User chooses a product.”
- “User Sends A Message”
- “Application Opens Profile Page”
You can group them under certain actions to be more organized.
There are a few design paradigms out there for any software development, but one you might have heard about is Object Oriented Design or OOD. It’s not only the easiest, but also gives complete control over all the processes you make in the application. For object-oriented design – and for the last process in the design – you’ll need to break your application into objects. It’s like modeling the real world in your application. Every object has its attributes and functions linked to it. A table, for example, can have many colors, 4 legs and it can hold stuff on its surface.
The design process is made regardless of the language you use. The language you choose will not affect your design. You can implement any design in any general-purpose language like the ones listed above.
The design phase should take you around 2-3 hours if you have a clear idea of what you’re making.
Step Three: Implementation
This is where the geeky programming will take place. If you’ve done a proper design, implementation will be fairly easy.
However, you need to understand how an android application works. You’ll most probably be using the Android Development Studio made by Google to make and test your applications.
Android applications, like web applications, are divided into activities, similar to web pages. Each activity is responsible for some inputs and outputs, has a certain layout, and could direct you to other activities.
Consider the image below:
You can add buttons, text boxes, labels and all different sorts of stuff in the layout section. Then you can add functions to these gadgets. You can even begin by writing a pseudo-code before you write the actual function.
In this image, I’m portraying an application that would read a number from the user and add up all numbers from zero up to that number, then display the result.
Bonus Step: Implementing A Database
If you decided to shoot for the stars with your first application, you might as well choose some complex features.
Your first application might involve some data going in and out. Like retrieving login credentials, or messages or even settings. For these functions, you’ll need a database to store the data. Think of it as a set of tables and columns that holds the data and manipulates it until it’s retrieved.
SQLite is an excellent option as it’s suited for embedded solutions ” like the phones”. It also allows you to bypass the implementation of a database management system. Which isn’t really gross to make, but would make the process a little bit more complex for a first application. You can find some very good courses on SQLite on udemy.com that will cover everything you need to know.
But again, this is a bonus step that you may or may not take into consideration.
Final Step: Testing your application
The final step is to test the application and see how it works. This step should be thorough and cover all possible Use Cases. It should even cover some abnormal behavior and how things might go wrong. Let it take its time and don’t rush it. The cool thing about the android studio is that it lets you test your application in actual environments. While you can run your code on your phone and test its performance there, physically, the most common practice is to use the emulators that simulate the performance of various phones. You’ll find a big set of phones to choose from, as well as a set of android systems for each phone.
If you follow the steps right, it might be a week’s worth of work or even less until you finish your application. Don’t hesitate if you get stuck at some point. There are multiple forums out there to help with any problems you might encounter. Befriend stackoverflow.com; it will answer all your needs – or at least a big majority. A lot of people have been there and you’re not alone. If you stop somewhere or get lost, feel free to re-iterate over the steps. They are meant to help you deliver a better Android application. If you don’t want to get started from scratch, you can rather look for app templates that will be helpful in taking you a leap forward. There are several sites that offer such app templates – just google for android app templates, free android app template or premium android app code etc., depending upon your needs and budget. You can also explore GitHub to find open source templates that can help you get started in no time.
Nothing will rival the joy of getting your first application done and running!