Before we can jump in and get started in Android Development, I think it is always important to ask yourself: Why am I doing this? Is this something that really excites me? And if so, can I see this as something me being sure of? These sort of questions, believe it or not, are the kind of questions you must keep in mind: to becoming a better learner; to making you realize what is right for you; to giving you more confidence.
I still remember when I first got started, the only thing I cared about was how cool it would be if I were to create an app, but this was no good approach. I mean, there is no harm in thinking this way, but if you’re not digging much deeper, like being able to identify with the purpose on what you intend to create, then a lot of the times: what can feel difficult, can feel even more difficult.
TRUST ME. BEEN THERE DONE THAT. AIN’T NO FUN.
And I’m not saying you must know everything, but it sure is of great help when you know at least why you’re creating that app or project. From own personal experience, I can say that I made so many attempts with learning how to code, but not until I took this approach, was it that I found clarity and direction in what I was doing. So, take a step back, don’t just code without first considering why, otherwise you’ll end up writing a lot of code that’s wasteful and irrelevant.
Kill me now plezeeeeeee.
Now that we have acknowledged the most important step, let’s proceed with the following:
1.Writing Java Syntax. It is always good practice to learn the basics, especially if you are new to programming. Hence, the more practice you get, the more comfortable you will feel when writing java code. Here are my 3 top recommended videos that you can freely watch to guide you with the basics: https://www.youtube.com/watch?v=RRubcjpTkks https://www.youtube.com/watch?v=3xuJIaP3C4g https://www.youtube.com/watch?v=hF8F3wm9DUc
2. Environment Tools / Setting Up. Don’t worry if you don’t understand much yet, we can always go back to this again. For these next few sections, you won’t be required to know programming, anyway. 😉
So, let’s continue and begin by downloading all the files and components that we’ll need to use, as we go along the way. To get started with the first component, in being the JDK (Java Development Kit), all we’ll need to do is, click and visit the following link: https://www.oracle.com/uk/java/technologies/javase/javase-jdk8-downloads.html After you have opened this link page, select the right version of download, like if you have a windows machine operating with a 64-bit processor, then go ahead and choose the windows x64 option. Simples. 😉
Once the JDK has been downloaded, the second step is setting up its path (Java Development Run) and JRE (Java Run Time Environment). To do this execution, you can simply open your control panel, check for advanced system settings, click on environment variables, and check if whether you have the path already imported inside the variable value, if not then just follow the action of copying and pasting the path found inside the JRK and JRE bin folder onto the system variables location.
And, if for some reason that doesn’t work, and you want to check whether the JDK path has been properly installed or compiled, then you can still do this by opening your command prompt and running the prompt command line “javac”, allowing you to view a display of all the file sources compiled.
The second component that we are going to need, is the installation and launching of Android Studio. This can be freely downloaded from here: developer.android.com. When the installation has completed, be sure to click the next button, a bunch of times, until you are found with the option of starting a new project.
Lastly, the final component to be performed, is the configuration of the SDK manager tools (this is to have Java operate efficiently and perform Java commands). You can follow this procedure by simply going over to the SDK manager and downloading all the SDK tools (required for Android App Development). And once proceeding with this stage, we can go ahead and create a new project. Yays.
3. Project Implementation. Begin by choosing a name for your project, one suited to your personal preference. Then once decided, choose an empty activity (for testing purposes), and end by clicking <Finish>.
4. Android Studio Framework. Notice how the project structure is displayed, with different files, containing such folders, yes? And if you expand all these folders (java, res, manifests, and gradle scripts), such other existing series of files may also be found. However, at this point, to make things less complicated, we will only be focusing on key folders (most frequently edited folders) for working and managing our first project in Android Studio.
So, let’s first look at what is in the java folder. This folder is where you will be storing all the source code files written in Java programming language. It is also the folder that generally includes all your classes such as the main class <MainActivity.java>. However, if we want to create a new class, we will need to do this manually. To do this, we can just right-click on the <MainActivity> class; select <new>; select <activity>; choose your chosen activity. And whatever changes you declare in one specific activity, you must also declare in the <MainActivity> as well.
( SideNote: For some things in this section, like declarations in java, I know my explanation is not as detailed, so feel free to go back to the videos if you want to learn more about declarations in java or see video link below: https://www.youtube.com/watch?v=xGo07JlJwvE ).
Now, coming to the res folder. Within this folder, as you may see, there are multiple sub folders such as Drawable, Layout, Values, etc. For example, if we look at what is in the drawable folder. This folder would be the place to hold all your various graphic files (photos, sounds, videos, and animations).
Meanwhile, the layout folder, is the place in which you have layout xml files. In other words, it is the folder that represents the design of screen, so how android objects (such as buttons, text, boxes, etc.) are positioned on the screen while the values folder, can be described as the place in which stores various attribute values (such as titles, labels, etc.). And as for the gradle folder, the gradle built scripts are used to automate testing, building, deployment etc.
But, not to worry, we will explore using all these features more later.
5. Hello World App: Learn by doing. In this tutorial, I will be creating a small Hello World App, offering a basic introduction on how you can start building and creating a simple yet functional Android app. And everything that we have gone through so far, we will be putting into real practice, so by the end of this tutorial, you should have a better understanding with at least the building blocks of an Android Application.
First, let’s have a peek look at what we’ll be building. The finished product will look like this:
Create the App Project (Hello World). Launch Android Studio, modify project name as “HelloWorld”, and end clicking<Finish>.
Android Virtual Device. To setup Android virtual device in Android Studio, click <Tools> and find section <AVD Manager>. Then, press <Create Virtual Device> and depending on what device you have, select the category <phone> followed by device options. And once this completed, proceed with <next>. Then, verify configuration download, and click on Finish.
Activity_main.xml. By default, when creating a new project, existing Java folders will automatically be created. However, it is always good practice when writing the code yourself; to know where pieces of code belong, and why it is needed there. So challenge yourself by creating a new activity_main.xml file in the layout folder, and once you are done with that, insert the following code below.
That’s all for now, i hope you have enjoyed reading this article. And remember — this is just the beginning, happy coding!
For more related articles in Android Development, check out the links below:
Android Library Unless you are writing a Download Manager, downloading files in an Android application is never going…
Tutorials - Javatpoint
Hi, I have written and developed this site so that students may learn computer science related technologies easily. I'm…