This tutorial is intended for those who are new to Android Studio, and will
- Introduce the fundamental concepts
- Steps to build your own app
Introduction
Android is an operating system that is built basically for Mobile phones. Android Studio is the official Integrated Development Environment (IDE) for Android app development. It is based on the IntelliJ IDEA, a Java integrated development environment for software, and incorporates its code editing and developer tools.
Supported Programming Languages
**Kotlin, Java, and C++** are usually used for logic processing and data access, and XML
is used for the layout and presentation. Other languages like C#, Python, and JavaScript can also be used for Android development, but they are not as popular.
App components are the essential building blocks of an Android app. Each component is an entry point through which the system or a user can enter your app. Some components depend on others. Each type serves a distinct purpose and has a distinct lifecycle that defines how the component is created and destroyed.
- Activities
- An activity is the entry point for interacting with the user. It represents a single screen with a user interface.
- An activity facilitates the following key interactions between system and app:
- Keeping track of what the user currently cares about (what is on screen) to ensure that the system keeps running the process that is hosting the activity.
- Knowing that previously used processes contain things the user may return to (stopped activities), and thus more highly prioritize keeping those processes around.
- Helping the app handle having its process killed so the user can return to activities with their previous state restored.
- Providing a way for apps to implement user flows between each other, and for the system to coordinate these flows. (The most classic example here being share.)
- Services
- A service is a general-purpose entry point for keeping an app running in the background for all kinds of reasons. It is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface.
- There are two types of services that tell the system how to manage an app:
- Started services tell the system to keep them running until their work is completed.
- Bound services run because some other app (or the system) has said that it wants to make use of the service.
- Broadcast Receivers
- A broadcast receivers is a component that enables the system to deliver events to the app outside of a regular user flow, allowing the app to respond to system-wide broadcast announcements.
- More commonly, a broadcast receiver is just a gateway to other components and is intended to do a very minimal amount of work.
- Content Provider
- A content provider manages a shared set of app data that you can store in the file system, in a SQLite database, on the web, or on any other persistent storage location that your app can access.
The manifest file
Before the Android system can start an app component, the system must know that the component exists by reading the app's manifest file, AndroidManifest.xml
. Your app must declare all its components in this file, which must be at the root of the app project directory.
The manifest does a number of things in addition to declaring the app's components, such as the following:
- Identifies any user permissions the app requires, such as Internet access or read-access to the user's contacts.
- Declares the minimum API Level required by the app, based on which APIs the app uses.
- Declares hardware and software features used or required by the app, such as a camera, bluetooth services, or a multitouch screen.
- Declares API libraries the app needs to be linked against (other than the Android framework APIs), such as the Google Maps library.