Chapter 1 - Mobile App Development
Chapter 1 - Mobile App Development
Chapter 1 - Mobile App Development
Introduction
Android is the world’s most popular mobile platform. At the last count, there were
over 2.5 billion active Android devices worldwide, and that number is growing
rapidly.
Gradle projects have a standard structure. Here are some of the key
files and folders we will be working on, as illustrated below:
Resource reference:
In Java: R.layout.filename
In XML: @[package:]layout/filename
This xml file is used to replace the Hard-coded strings with a single
string.
Resource reference:
In Java: R.string.string_name
In XML: @string/string_name
Resource reference:
In XML: @[package:]style/style_name
Resource reference:
In Java: R.color.color_name
In XML: @[package:]color/color_name
Developers write code to run on this layer, and users see the screens
created by apps in this layer.
The ART runs on many different kinds of hardware, but ART isn’t
tailored for any particular kind of hardware. Instead, HAL does.
It manages all the drivers needed during the runtime of an Android device,
such as camera drivers, display drivers, audio drivers, Wi-Fi drivers,
Bluetooth drivers, and memory drivers, among others.
You can use it only when needed – for example, to handle complexity
or favor reusability.
They perform tasks, display information to the screen, and act upon
data from a variety of sources.
There are mainly two types of context: which are Application context
and Activity context.
Creating views.
Types of Intent:
Explicit Intents:
Specify which application will satisfy the intent, by supplying either the target app’s
package name or a fully-qualified component class name.
Implicit Intents:
Don’t name a specific component, but instead declare a general action to perform, which
allows a component from another app to handle it.
However, it’s important that you understand each one and implement
these that ensure your app behaves the way users expect.
8. TextView:
A text view is a user interface element that displays text to the user.
A linear layout can also have a gravity attribute that affects its gravity.
So you can align two elements by right border, or make one below
another, centered in the screen, centered left, and so on. By default, all
child views are drawn at the top-left of the layout, so you must define
the position of each view using the various layout properties.
android:layout_centerVertical
If “true”, centers this child vertically within its parent.
android:layout_toRightOf
Positions the left edge of this view to the right of the view specified with a
resource ID.
It’s similar to Relative Layout in that all views are laid out according
to relationships between sibling views and the parent layout, but it’s
more flexible than Relative Layout and easier to use with Android
studio’s layout editor.
So you can build your layout with Constraint layout entirely by drag-
and-dropping instead of editing the XML.
Each constraint defines the view’s position along either the vertical or
horizontal axis; so each view must have a minimum of one constraint
for each axis, but often more are necessary.
When you create any component in the xml file, id for the
corresponding component is automatically created in this file.
The id can be used in the activity source file to perform any action on
the component.