The most widely used operating system for mobile phones is Android. Unsurprisingly, everyone wants to learn the skill of Android App development. Well, it's easy even if you're not a developer. Any programming enthusiasts with a basic understanding of programming and brief knowledge of how Android Studio works can build their app. 
 
We will be learning the fundamentals of Android App Development in the article today. We will study the Android components, basic fundamental definitions and much more. However, before we move on and tell you all about the complex folders and what their importance is, let us do a quick review of what android is?
 

What is Android?

Android is a mobile operating system developed by various developers (mostly Google and Open Handset Alliance). The operating system is written in Java (UI), C (Core), C++, and others. 
 
Android OS belongs to the OS family of Unix-like, which is a modified Linux Kernel. It is primarily designed for mobile devices, touchscreens, smartphones, and tablets. It was announced in November 2007, and the first commercial Android device was released in September 2008.    
 
Android has been the best selling smartphone OS worldwide since 2011 and tablets since 2013. Currently, the operating system has over 5 billion monthly active users. 
 

 Android App Development Fundamentals

Android App development becomes easy when the developers or App development enthusiasts are fully aware of the fundamental concepts that go behind the app development. 
 
We will be looking at the core fundamentals of Android App development. We will go through the components of App development, the language proficiency required, the ideal layout of the app, and the entire lifecycle of the Android Application.
 

Android Programming Languages

We will start with the Android programming language because without this, nothing is possible. There are three primary languages in which Android apps can be developed. They are Java or C++ and XML. Java/C++ is used for the working of the app, while XML markup language is used for the front end of the app. Recently, a new language known as KOTLIN is also being preferred in place of Java/C++. Let us get a brief picture of these languages. 
 

1. Java

Java is a class-based object-oriented programming language. It is designed to work with minimum dependencies which is one of the reasons it is preferred for Android App development. JAVA programming language is a general-purpose programming language designed to let programmers write once, run anywhere (WORA). This means that a compiled JAVA code can be run on any platform that supports JAVA. 
 

2. C++

C++ is another language that could be used for application development. C++ is also a general-purpose programming language. C++ first appeared in 1985. Over the years the language has gone through multiple overhauling and modern C++ is object-oriented, generic, and has functional features.
 

3. XML

XML is referred to as an Extensible Markup language that defines rules for encoding documents in a format that is human readable and also machine-readable. The design goal of XML is simplicity, generality, and usability across the internet. 
 

4. KOTLIN

KOTLIN is a cross-platform, general-purpose programming language that is designed to interoperate fully with JAVA. It first appeared in 2011, and in May 2019, Google announced that KOTLIN is now its preferred programming language for Android App developers. The language works on platforms like: 
  • Android,
  • iOS, macOS,watchOS, tvOS
  • Windows,
  • Linux
  • Javascript
  • WebAssembly
  • LLVM

Android Components

Consider Android App Components as building blocks of Android App development. Each component has its specific purpose to serve, and each component has its life cycle. Some of the components are independent while the rest of the components are interdependent. There are four major components that we will be looking at in detail. 
Activities
Activities as the name suggest are the activities the app performs when it is interacted with by any user. It deals with UI and user interactions to the screen. The number of total activities depends upon the functionality of the app. The first activity of the app is performed when the app is launched. Hence, any app performs a minimum of one activity and it is known as MainActivity. 
 
 public class MainActivity extends Activity{
  // processes
}
 

Services

Services are the background activities performed by the app. It could be listening to a song while navigating towards your destination through Google maps. The main purpose of this component is to provide non-stop working of the app. Service may require another sub-service to perform the tasks   
 
 public class MyServices extends Services{
  //code for the services
}
 

Broadcast receivers

A broadcast is used to respond to messages from other apps or systems. Broadcast Receivers receive the broadcast and take suitable action. For example, when the battery of a phone is low, the SystemOS fires a broadcasting message to launch the battery saver and the app takes necessary actions. 
 
The broadcast receiver is the subclass of BroadcastReceiver and each object is represented by intent objects. The context receives the broadcast and the intent is the outcome based on the context. 
 
public class MyReceiver extends BroadcastReceiver{
   public void onReceive(context,intent){
   }
 

Content providers

Content Provider is used to transfer the data from one application to the other at the request of the other. For example, the Facebook app requests access to your contacts and messages. These are handled and managed by class COntentResolver class. 
 
This class uses a set of APIs (Application Programming Interface) that enables other applications to perform the transactions.    
 
public class MyContentProvider extends ContentProvider{
   public void onCreate()
   {}
}
 

The layout of Android Applications

Android applications have a strict layout. There are certain folders such as Manifest, JACA folder, Res Folder, and Grade Scripts dedicated to their specific tasks. Enthusiasts and students on their way to make their first app must understand the purpose and significance of each folder. Let us go through each one of them in brief. 
 

1. Android Manifest

Android Manifest is the XML file that describes all the information needed from the app, the Android build tools, Android Operating System, and the Play Store. Android Manifest also contains the permission required by the app to perform its tasks. In addition to the information and permission, The XML file also stores the Hardware and Software features of the app. This is help[ful to determine the compatibility of the app in the play store. 
 
Other information stored in the file includes special activities like services, broadcast receiver, content providers, package name, etc. 
 

2. JAVA Folder

JAVA Folder consists of all the required JAVA files dedicated to performing specific tasks of the app. The folder also comprises functionality, and utility of the buttons, calculation, storing, variables, toast(small popup message), programming function, etc. The folder contains all the java and kotlin source code created during the app development. 
 
 

3. Resource Folder

The resource folder consists of all the noncode files of the application such as Images, XML layouts, UI strings for the android application. This makes it the most important among many. The Res folder consists of subfolders like drawable, layout, mipmap, raw, and values. 
 

4. Drawable

Drawable consists of all the images used in Android Application. 
 

5. Layout

Layout Folder consists of all the XML files needed for the proper working of the Android application. As we have studied earlier, that app performs at least one activity. Thus, the folder contains activity_main.xml.
 

6. Midmap

Midmap folder of the Res folder consists of launcher.xml. The Launcher XML file is used to define icons shown on the home screen of phones and tablets. The Launcher has multiple density icons Based upon the size of the device screen.
 

7. Raw

Raw folder contains all the media files other than images such as audio files or music files. These can be accessed by syntax: R.raw.filename. 
 

8. Values

Values folder is sussed to store the values, colors, strings, integers, and more. It consists of the following directories.
  • R.array :arrays.xml for resource arrays
  • R.integer : integers.xml for resource integers
  • R.bool : bools.xml for resource boolean
  • R.color :colors.xml for color values
  • R.string : strings.xml for string values
  • R.dimen : dimens.xml for dimension values
  • R.style : styles.xml for styles

Gradle

Gradle is storage for multiple build systems that when called can be applied to the ap modules. The gradle folder is independent of Android studio. They manage the entire build process. It provides processes and configuration settings specific to building and testing Android applications.
 
 
Armin Vans
Sheyans is a Android Certified Developer and certified professional with rich experience in Application Development, Programming, and Corporate training. He delivered training on CEH, CPENT, ECSA, Security+, CNDV2, CISSP, CISM, Android, iOS, Java, Objective C, Swift, and Xamarin Mobile Framework.

COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here
You have entered an incorrect email address!
Please enter your email address here

Loading...

Submitted Successfully...