Beginning Android Development – Part 2/3

In part 1 of this three part series, we examined the exciting world of Android development career, beginning with this post I will start to introduce the fundamentals of Android development. The fundamentals we will cover are the Activity, Fragment, Intents, Layout, Shared Preference, ListView, Adapter and just enough Java. Don’t worry if you do not know what any of those terms mean, at the end of next post you will have a better understanding of not only what those terms mean but where they fit into in Android development. These are the concepts that I believe that you need to grasp to embark on this exciting journey as an Android developer.

Core Android Concepts and their Meaning

Activity – the Activity is at the center of Android development, it is a defined task that you want to accomplish. Making a phone call is an Activity, sending an email is an Activity, displaying a list of all countries in the world is an Activity. Another way to understand an Activity is to think of it as a window or web page. You are reading this article on a web page, that can be likened to an Activity. If you click on any link within this page then you can leave this web page or Activity and go to another web page which could be an unrelated web page in different website. The same applies to Activity, you go from one Activity to another which could be a different app to accomplish tasks, this givens the illusion of an “app” while in reality it is a coordination between different Activities.

Fragment – the Fragment is a scaled down version of the Activity that allows for more than one screen to be placed in one screen. No that was not a typo, multiple screens in one screen! Let me explain, with the Activity each focused thing you want to do such as ” List Emails”, “Read Emails”, “Write New Email” occupies one screen. With Fragment you can display the list of emails on the left and read the emails on the left of the same screen. Fragments were introduced to take advantage of the larger screen sizes of tablets while Activity was introduced back when phones were the only game in town,

Intent – back to the analogy of the web page we used above, if you wanted to go from one web page (Activity) to another web page (Activity) instead of writing the programmatic logic that performs the communication from one Activity to the next, you simply declare your INTENTion to communicate with another Activity. Intent is a brilliant concept that is unique to Android and one that you have to thoroughly understand to thrive in your Android career. It saves you time and provides seamless user experience for the user. Lets say you write an app that needs a picture say a Family Album App that displays family photos, instead of writing the immense lines of code that handles taking picture with the device camera, you simply declare an Intent with very few lines of code that you want to take a picture and Android will allow the user to take picture with any camera app on the phone and return that picture to your app.

Layout – if you are reading this article on a PC screen, look at the top right hand you will see a small section with a search box and a button. When you type in a search term in that box, it will search the site and display the result. That search box and the button and their look and feel is defined with a markup language called HTML/CSS, in Android this is analogous to XML layout. When you type a term in the search the logic to perform the search is written with a programming language called PHP in Android this would be Java. If you have an Android device, take a look at any app, before you touch that app, everything you see in the screen is called the user interface and it is laid out (layout) with a markup language called XML. When you touch that app on your device if it does any interaction, the logic that performs that interaction is written in Java. Starting Android development you need to maintain competence in both XML and Java.

Shared Preference – this is an importance component of Android that with an interesting name, it allows you to save key value pairs of information to your device. Key value pairs is when you save information, you provide a key or an id so you can use it to retrieve that information later. For example, if you create an note taking app, the days can be the keys, so on Monday the key will be “monday” and the value will be ” a very warm day”, later if you need to retrieve the information you saved for Monday you can use the key “monday” to look it up in the Shared Preference. Other ways to save information in Android are using SQLite Database, saving on the Network, internal and external storage. Of these SQLite is the most prevalent; however at this point we will skip it for now, because if we delve into SQLite Database you may be overwhelmed, confused and amazed. At the end of this series, I will have a different tutorial series focused on Android SQLite.

ListView – textview and listview are the two most widely used widget in Android development. Widgets are user interface (View) elements you see and interact with on Android screen such as button, textview, imageview, etc. Textview is used to display text and listview is used to display list and most Android apps will either have a text or list to display – list of contacts in phone, list of days of the week, list of options, list of customers, etc there are list every where and until recently these are displayed with a listview. The humble listview has however been replaced with a newer/advanced list rendered called RecyclerView.

Adapter – we just mentioned above that there are few options where you can save data in Android. Lets say you are building an app to display all the employee names of a 10,000 employee company. Of course you will use the listview to display the names, however the listview only knows how to display lists, it does not know how to figure out where the data you want to display in the list is coming from. That is where the adapter come in, it gets data from your datasource massages it and pass on to the listview. You will use listview or (now Recycler View) and adapter a lot in your Android development career.

Java – we use Java to inject interaction into our app. Java is one the most popular object oriented programming (OOP) language. OOP is a programming approach that models the application to be build using objects, methods and properties. If you are completely new to programming, you can certainly use an introductory class to Java such as this one. If you have some background in any programming especially an OOP language then I think you can proceed with learning Android development and pick up Java as needed. You can certainly proceed learning Android development with zero programming background however you will struggle a lot as new concepts upon new concepts are thrown at you. It certainly doable if you are formidable enough.

Android Development Tools

Like every profession, there are tools that are used to develop Android app, and you will be an efficient developer to the extent that you master the tools of the trade. Here are the list of the tools that you need to get started with Android development.

Android Device – you will need an Android device to constantly test the app that you are building. There are many Android devices and the phone and tablet are the most common form factor. Android phones and tablets comes in different make and model such that it is impossible to have every make and model, however you need to have at-least one physical device. Alternatively you can use a virtual device which are known as emulators to test your Android apps as you learn and build. I recommend over the stock Android emulator because it is faster.

Development Computer – you need a computer that you can use to write the code for your Android app. If you have a relatively modern computer chances are that it will be sufficient to get started.

Software Development Kit – I suspect that McDonald new franchisees will receive a set of guideline and support materials from McDonald that will help them run their franchise such that its operations are consistent with every other McDonald, we can call this set of guideline business development kit. The same concept applies to Software, when you develop Software that is backed by a major Software corporation they will normally provide you with a set of guideline, tools, support materials, software packages, etc that will aide you in creating software that is consistent with that platform. That package is called Software Development Kit of SDK, so for Android there is an Android SDK provided and supported by Google, if you develop for the iOS platform there is an SDK provided and supported by Apple, if you develop for the Windows platform there is an SDK provided and supported by Microsoft and so on.

Integrated Development Environment – painters use paint brush to create their work, potters use their hand to create pottery and programmers use the keyboard to type their code. This code can be typed into any editor such as notepad. However there are special purpose editors that are specifically made to for writing code the same way special editors such as Microsoft Word are made for creating rich content. These special purpose editors are called Integrated Development Environment, because a lot of tools, bells and whistles are packed on top of the editor to make the work of the programmer easier. Whats more, there are specialized IDEs suited for different type of software development such as web development and the one that is purpose built for Android development is called Android Studio.

Android Studio – a laptop and Android Studio is all you need to start Android Development right now; because Android Studio is an all in one productivity software that includes an IDE, SDK and Emulator. You can certainly install all of these components seperately however you are better off downloading the ready to go package from here.

Notepad – Not a requirement but a neccessity, plan to take note from day one. You will encounter new concepts and terms and how-to as you get started with Android development. Do not commit everything to memory, write some down and go over your note as often as possible. Evernote is great option.

Setup – once you gather all the required tools, it is quite easy to setup and get started with Android development. Follow these steps to setup your Android development environment.

Setup Development Environment

Time to put together our development environment.

Get a Computer – so what did you decide to do? did you want to use your existing computer or get a new one. If you have the resources getting a new PC hat is solely dedicated as a development machine is not a bad idea. If you want to wait to make sure that this is the career for you that is fine as well, either way if you want to proceed you need to lay your hands on your own computer running either Windows, MAC or Linus operating system.

Check for Requirements – once you have procured a development PC the next step is to check if that PC meets the minimum requirement for running Android Studio. Most modern PCs either MAC or Windows will meet this requirement however for the interest of due diligence you can find the system requirements here , if your PC exceeds the requirements the better.

Download Android Studio – this is the main event and you can find the download page here and there are download options for MAC, Windows and Linux, select the appropriate installation bundle for your operating system and download.

Download Java – oops, I forgot to mention that there is a seperate SDK for Java so we have to download that separately too. Event thought the system requirements listed Java 7, you can also use Java JDK 8 because Oracle not longer provide update for JDK 7. You can download Java Development Kit 8 here select the appropriate installation file for your operating system.

Download Genymotion – the emulator from Genymotion provides better performance over the stock Android emulator. Registration is requirement before you can download the tool from here
Install Java – locate the executable that you downloaded from Java and run it, take not of the installation path because you will need it again.

Install Android Studio – locate the Android studio file that you downloaded and run it, follow the installation wizard prompt and when prompted copy and paste the Java installation path

Install Genymotion – in the same manner, located the Genymotion installer and run, follow the prompt of the installation wizard. It will install something called VirtualBox which it needs to create the emulators.

Create Workspace – not strictly required but now is a good time to create a dedicated folder in your hard drive where you will be saving your projects.

Run Android Studio – take your new setup for a drive, fire up Android Studio and you will be presented with this prompt if everything worked as planned.


About the Author valokafor

I am a Software Engineer with expertise in Android Development. I am available for Android development projects.

follow me on: