Key Concepts of Android App Development

Android is an open source mobile platform launched by Google in 2008 and ever-since it became the favourite for people and developers around the world. Android is Linux based multiprocess and multithreaded OS. Google’s Android OS is not limited to phones but you can use it to build a DVR, a handheld GPS, an MP3 player etc.

Although Android platform is an open source and customizable, Android users and developers have become habitual to the constructs developed by Google for Android devices. The use of these Android concepts is vital for developing an application quickly.

Key Concepts of Android are:-
Apps and APK Files
Activities
Fragments
Views and ViewGroups
Layout XML Files
Intents
Widgets
Services
Sensors

I am giving you an overview of the Android key concepts. After having a basic understanding of Android’s key concepts you can go deeper into the various different topics.

Apps and APK Files

An Android app is an Android Application. An app is packaged in an APK file i.e. Android application package. The APK file contains the compiled Java code and other resources like images and texts for the Android application

Activities

An Android activity is a GUI component. You can understand it as a window in a desktop application. As mobile phone screens are small, an activity takes up the whole screen. If you open multiple activities then they are stacked on top of each other. You cannot arrange activities side by side like you can do with desktop windows.

Activities are unique, focused actions which a user can take. As it is difficult to scroll, zoom in or click links on a small screen hence it is recommended that an app display only one activity per screen. This will present the most relevant information to the user and allows them to launch a new screen for additional information or click the back button to view the previous activity. The screen can expose multiple tasks but it should help the user complete just one activity at a time.

Fragments

In Android, a fragment is a fragment of a total user interface. A fragment only takes up part of the screen. Fragments are used in the activities. Fragments can also be used within different activities. Fragments contain Views and ViewGroups inside them.

View and ViewGroups

Android GUI elements come into three categories i.e. Activities, Views and ViewGroups. Activities are the windows/screens. Views are the individual GUI elements, like a TextView which displays a text, a Button that users can click on etc. ViewGroups are containers for Views. A ViewGroup actually groups a collection of Views together. Views and ViewGroups can be nested inside an activity or inside even a fragment which is nested inside an activity.

Layout XML Files

Activities, fragments and ViewGroups can use XML files to define their layout and contents. The layout XML files tell which GUI components an activity or fragment contains and also the styling of the GUI components i.e. The size, margins, padding etc.

Intent

If your app requires performing a function beyond its core capabilities like opening a photo, playing a video or looking up a contact then you should find out whether a tool that can perform that function already exists in the OS or in a third-party app. If yes then you can get the benefit of that functionality using intents.

For e.g. If your app accesses user contacts then you can use intent objects to launch the device’s existing Contacts application. This removes the programming duplication and also speed up the user’s interaction with the device as the user will not need to learn again how to add a contact to your app.

Widgets

Android Widgets are actually GUI components which can be displayed outside of an activity. For e.g. A weather widget which shows today’s weather is shown on many Android home screens. Widgets have been packaged and implemented as part of an Android application. Also sometimes Views in Android are also referred to as widgets. For e.g. Many GUI components are placed in a Java package called android.widget. GUI components are not same as a widget which can remain on the home screen of an Android device. Hence you should understand the difference between GUI components which can be used inside ViewGroups, Fragments and components which can be used inside ViewGroups, Fragments and Activities and also inside Widgets and Widgets which can remain on the home screen of the Android device.

Services

In Android, Services are background process which can be executed on an Android device even if no application is visible. Services do not require a user interface. For e.g. A Service can check a remote server for updates or backup data every hour.

Sensors

Android devices have many inbuilt sensors which you can access from your Android applications. For e.g the inbuilt GPS in smartphones is a sensor. Therefore you can get access to the GPS from inside your Android applications.