Blog

Android Tutorials

23 February, 2021

Related Blogs

Android tutorial

As you know that we are living in the world of technology, where the organizations are keeping the focus on the aspects of the competition in the market. Every organization requires its online presence and is also able to communicate with online users efficiently. Every individual is now using the smartphone. No one can indeed live without a smartphone as well.  Though there is a high demand for smartphones, everyone who is reading this is in a dilemma whether to go with Android or iOS Technologies.

According to my opinion,  I would say Android is the best.  Android is referred to as a mobile operating system that is developed by Google. Android is specifically designed for touch screen enabled devices such as tablets, smartphones, etc. With the launch of Android, Google has brought up immense changes in the life of every person. Android is designed in such a way that it will help in understanding the needs of the organization or a person with the immense features and also makes changes to the look and feel of a device.

In simple terms, Android is referred to have a Linux-based mobile operating system. Android is a source and free operating system,  allowing the users to download them and make the changes as per the requirements.  The developers should focus on coding only at a software level,  making changes for the user experience, updating new features, etc which has brought up the Android application development easier than expected.

Knowledge Base

Do you want to master Android? Then enroll in "Android Training" This course will help you to master Android

Why Android?

Android is one of the most common operating systems that is working on smartphones.  80% of the people are now using the Android operating system and there is a high demand for Android rather than iOS Technologies. There are some reasons why Android is used rather than other Technologies for mobile application development.  Below is the list of reasons why  Android has got its name in less period of time.

1. Android is an open-source operating system.

2. Android allows inter-app integration.

3. Android is a customizable operating system.

4. Android has the highest success ratio.

5. Android has a larger developer origin and community.

6. Android has a rich development environment that allows developers to develop multiple sets of apps.

7. Android will also help in reducing the cost of development and the overall complexity.

The architecture of Android:

An android operating system is referred to as a software stack that includes a different set of layers. Each layer includes a set of program components. It specifically includes the operating system, middleware, and other components. Every layer in the architecture of Android will be providing different services to the layer that is present above it.

Below is a brief explanation of each layer in the Android stack.

1. Linux Kernel layer: the Linux Kernel layer is the bottom-most layer that is available in the architecture of Android. It is not responsible for reacting with the users on the developers. However, Linux is called the heart of the Android system. The Linux Kernel layer is responsible for performing the functions or providing the functions to the Android system. The functions that the Linux Kernel layer provides are security settings, hardware abstraction, Network Stack, memory management programs, other hardware drivers, etc.

2. Libraries: the next layer that is present above the Linux Kernel layer is the libraries. Libraries are responsible for carrying the set of instructions to guide the device and handle the different forms of data. Let us take an example of the playback and recording of the different audio and video formats.  The functionality is performed efficiently by using the media Framework library which helps in guiding how to perform the action.

3. Runtime: The next layer in Android architecture is runtime which is responsible for providing one of the key components called Dalvik virtual machine. Dalvik virtual machine or simply DVM is referred to as open-source software and also a Java Virtual Machine which is specifically designed and optimized for Android systems.

4. Application framework layer: The Application Framework layer is the next layer to the runtime. The applications will be directly interacting with the blocks of Android architecture. All the programs that a present will be responsible for managing the basic functions of the mobile or a phone like voice call management, resource management, etc. Apart from this, it is also providing high-level services to the applications which are represented in the form of Java classes. Application framework includes a set of important blocks called notification manager, activity management, content providers, view system, etc.

5. Application layer: application layer is the topmost layer in the Android architecture. This layer involves the installation of all the applications such as games, address books, etc.

Features of Android

As we all are using Android mobiles, we know that Android has come up with plenty of features which is making it more competitive and improving the demand for the product. Below the set of features in Android.

1. User interface: the Android operating system is flexible to provide the best look and feel as it uses an intuitive interface that looks so beautiful.

2. Storage: the Android operating system makes use of the relational database -SQL (SQLite) to perform storage-related activities.

3. Messaging: the Android operating system is flexible to provide its support to messaging services like MMS and SMS.

4. Connectivity: the Android operating system is compatible to establish various connections such as Wi-Fi, Bluetooth, CDMA, etc.

5. Web browser: Android operating system is dependent on the open-source Webkit layout engine which is included coupled along with the Chrome V8 JavaScript engine which provides its support to CSS and HTML.

6. Wi-Fi direct: Android is also flexible to support the technology that helps in discovering the applications and pair them directly using a high bandwidth peer to peer connection.

7. Multitasking: Android is flexible to provide support for different tasks and allows the user to perform multiple tasks at the same time.

8. Multi-touch: and has also come up with the feature and also provides its support for the multi-touch.

9. Multi-language: Android is flexible to provide support for multitasking and also supports both bidirectional and single direction text features.

Building blocks of Android:

Android includes five main components that are considered as building blocks within the Android application. They are:

1. Activity

2. Services

3. Broadcast receivers

4. Content providers

5. Manifest

Let me give you a brief understanding of each building block of Android.

1. Activity: The activity usually refers to the screen representation of the application in Android. Activity is referred to as an entry point for user interaction. There will be a layout file for each activity in which we can place the user interface. There can be multiple activities in an application. Let us take an example of a Facebook start page. You will need to enter the email or phone number and also the password to login to the Facebook page. This is referred to as one activity. There are two methods in which subclasses of the activities can be implemented. They are:

onCreate (Bundle): The onCreate bundle is a method in which the initialization can be performed. You will need to call setContentView(int) along with the layout resource which will define your user interface. You are also a love to retrieve the picture in the US are interface by making use of the method findViewById(Int). These are used specifically to interact programmatically.

OnPause(): This is one of the methods which is specifically responsible for dealing with the user whenever it leaves the activity. Any small change made by the user will be committed by the content provider which holds the data.

2. Services: A service in Android is referred to as a background process that is responsible for performing long-running operations. Let us take an example in which the service of a particular location is active in the application. However, the user is using a different application. This means that the user is not disturbed by an activity. There are two different types of services available on Android. They are:

1. Local service: The local service allows the user to be accessed from within the application.

2. Remote service: The remote service will be allowed to access remotely using the other applications that are running on the same device.

3. Broadcast receiver: The broadcast receiver is referred to as a mechanism in which the host application will be able to listen to the system-level events. A broadcast receiver is specifically used by the applications that require the execution based on the system events. Some of the examples will be listening for the incoming call, or SMS, etc. The broadcast receivers are responsible for helping in responding to the broadcast messages from the system or the different applications. It is also so used to perform the handling of communication between the applications and the Android Operating System.

4. Content provider: The content provider are responsible for managing access to the structured set of data. A content provider is referred to as a standard interface that is responsible for establishing for collecting the data in one process with code running in another process. They are responsible for encapsulating the data and also providing the mechanism to define data security. The content providers are also used to ensure that the data is shared between different applications.

5. Manifest: A manifest file plays an important role as it is responsible for providing important information for essential information about your application to the Android system. This information is required by the system before it is being run on any of the application code.

Reminder first file is responsible for performing the below tasks:

1. The manifest file will help in naming the Java package for the application. In this, the package name is considered as a unique identifier for the application.

2. The manifest file is also responsible for declaring the minimum level of application programming interface and also responsible for listing the libraries that are linked with the application.

3. The manifest file is also responsible for protecting the application in order to control the access protected parts by declaring the permissions.

4. The manifest file is also capable of listing the instrumentation classes which are specifically responsible for providing the profiling and the information that is required as and when the application runs. Also, this information will be removed from the system as soon as the application is published. The manifest file will remain only when the application is in development mode.

Environment setup of Android:

I think you will be happy when you know that you can start the and application of any of the different operating systems that are listed below:

1. Microsoft Windows XP or any other updated version.

2. Mac operating system 10.5.8 or any other updated version.

3. Linux that includes GNU C Library or any other updated version.

One more important point to be considered is that the tools that are required for developing Android applications are freely available in the market and can be downloaded from the web. Below is a list of the software that you need before you work on the Android application programs.

1. Java JDK 5 or the latest version

2. Android studio

Let me give you a brief explanation about each tool they are used to set up the environment.

Set up Java development kit or JDK:

As it is available free, you can download the latest version of Java JDK from the Oracle Java site by clicking here.

You'll also see the instructions that will help you in installing the JDK in the downloaded files. You need to follow the onscreen instructions to install and set up the configuration as well. The final step is to set the PATH and JAVA_HOME environment variables which help you to refer to the directory that contains Java and Javac.

If you are using Windows and you have installed the JDK in the C drive, C:jdk1.8.0_102, you need to enter the following line in your C:autoexec.bat file.

set PATH=C:jdk1.8.0_102bin;%PATH%

set JAVA_HOME=C:jdk1.8.0_102

you can also try another way wherein you can just right click on my computer> select the properties, then click on the advanced option followed by the environmental variables. You can then update the Path value and click on the Ok button.

If you are using Linux, and the SDK is already installed in /usr/local/jdk1.8.0_102, then you can use the C Shell. The below code can be used into the .cshrc file.

setenv PATH /usr/local/jdk1.8.0_102/bin:$PATH

setenv JAVA_HOME /usr/local/jdk1.8.0_102

If you are using the Android studio, then it will be able to identify the path where you have installed Java.

How to make Android applications?

Let me take an example and explain how Android applications will be created. In the below example, we will be creating the simple hello Android application using the Eclipse IDE.

In order to create a simple example, you will need to perform the three different steps. They are:

1. Create a new Android project

2. Write the message Optional)

3. Run the Android application.

Let me take you through the three different steps clearly.

1. Create the new Android project: In this step, you will need to follow the below instructions.

1. Select start a new Android studio project.

2. Give all the information that is required which includes the application name, company domain, location of the project, name of the package, and then click on the next option.

3. The next step is to select the application programming interface level of the application and then click on next.

4. You need to click on the activity type (empty activity).

5. Update the information like the activity name and then click on finish.

Activity configuration is completed, the Android studio will auto-generate the activity class and information that is required along with the configuration files.

This will complete the creation of the Android project. You can then start exploring the Android project and view the simple program.

How to make android applications

2. Write the message:

 Android Studio will automatically generate the code for the activity_main.xml file.  You are allowed to edit the file as per your requirement.

package first.javatpoint.com.welcome;  

import android.support.v7.app.AppCompatActivity;  

import android.os.Bundle;  

  public class MainActivity extends AppCompatActivity {  

    @Override  

    protected void onCreate(Bundle savedInstanceState) {  

        super.onCreate(savedInstanceState);  

        setContentView(R.layout.activity_main);  

    }  

3. Run the application:

In order to run the application, you need to click on the run icon on the toolbar or either press shift + F10.

Once time it will take 2 to 3 minutes for the Android Emulator to boot. Once the emulator is booted, the Android studio will install the application and based on that the activity will be launched.

How to make android applications

Advantages of the Android operating system

Android Operating System has come up with multiple advantages. They are listed below.

1. Millions of applications: The users are allowed to choose which application they need. The applications are categorized into multiple topics and each topic will have a large number of applications that the users can download.

2. Notifications are displayed: all the notifications of different applications, emails, low battery, etc are displayed on the mobile. The users will be able to access the notification just by sliding from top to bottom in the smartphones. Even though the mobile is in lock mode you can view the notifications.

3. Internet sharing among multiple devices: You are allowed to share the internet from your device to the other devices by using the mobile hotspot option or with a PC. It also helps you in saving money. If you are living in a house you can share the internet with other people and they don't need to buy any sort of internet packages again.

4. Third-party application support: the users are also allowed to install the third-party application and which can be downloaded from different websites. The users will be given the option to choose the apps that they want to download from the Google Play store or any other website. The only thing that you need to do is to authorize the app that you want to download.

5. Expandable memory: Android phones have expandable memory while Apple smartphones and tablets do not have. If you want to store a large amount of data then you can attach external memory to expand your phone memory. You are allowed to store movies, books, etc.

6. Run multiple applications at the same time: If you are using a good specifications phone, then you are allowed to run the multiple apps smoothly at the same time. You can listen to music while using online social media sites like Facebook or WhatsApp.

7. Large community support: There is a large community of users and developers of Android. If there is any issue in the code or if you want to check The authenticity of the application, then you can easily perform this. You can check for the reviews if the app is real in the Google Store.

8. Open source: Android is licensed in Apache. Developers are also having access to the core code and also allowed to make changes to the code.

9. Demand for jobs: as millions of people are using the applications,   there is a high need to maintain and develop new applications. Hence, there is a high demand for jobs and a lot of resources are required to make the job requirements.

Conclusion:

Android has got its own demand in the current market and also there is a high need to create and develop applications based on the user experience and the requirements.  I hope the above information is helpful to you.  In order to attain the best career,  you need to choose the right technology with the right career opportunities.  I would say Android is one of the best technologies which would help you in attaining the best career.