Skip to main content

Learn android basic

 

Tetum Version


Basic Lesson 1 - Introduction to Android


Android is a complete set of software for mobile devices such as tablet computers, notebooks, smartphones, electronic book readers, set-top boxes, etc.

It contains a Linux-based Operating System, middleware, and key mobile applications.

It can be thought of as a mobile operating system. But it is not limited to mobile only. It is currently used in various devices such as mobiles, tablets, televisions, etc.



What is Android?


Before learning all topics of android, it is required to know what is android.

Android is a software package and Linux-based operating system for mobile devices such as tablet computers and smartphones.

It is developed by Google and later the OHA (Open Handset Alliance). Java language is mainly used to write the android code even though other languages can be used.

The goal of the android project is to create a successful real-world product that improves the mobile experience for end users.

There are many code names for android such as Lollipop, Kitkat, Jelly Bean, Ice cream Sandwich, Froyo, Ecliar, Donut, etc which are covered on the next page.


What is Open Handset Alliance (OHA)?

It's a consortium of 84 companies such as Google, Samsung, AKM, synaptic, KDDI, Garmin, Teleca, eBay, Intel, etc.
It was established on 5th November 2007, led by Google. It is committed to advancing open standards, providing services, and deploying handsets using the Android Platform.

Features of Android

After learning what is android, let's see the features of android. The important features of android are given below:

  1. It is open-source.
  2. Anyone can customize the Android Platform.
  3. There are a lot of mobile applications that can be chosen by the consumer.
  4. It provides many interesting features like weather details, opening screen, live RSS (Really Simple Syndication) feeds, etc.
  5. It provides support for messaging services(SMS and MMS), web browser, storage (SQLite), connectivity (GSM, CDMA, Blue Tooth, Wi-Fi, etc.), media, handset layout, etc.

Categories of Android applications

There are many android applications on the market. The top categories are:
  1. Entertainment
  2. Tools
  3. Communication
  4. Productivity
  5. Personalization
  6. Music and Audio
  7. Social
  8. Media and Video
  9. Travel and Local etc.


History of Android

The history and versions of android are interesting to know. The code names of android ranges from A to J currently, such as Aestro,Blender,Cupcake, Donut, Éclair,Froyo,Gingerbread, Honeycomb, Ice Cream Sandwich, Jelly Bean, KitKat and Lollipop. Let's understand the android history in a sequence.


  • Initially, Andy Rubin founded Android Incorporation in Palo Alto, California, the United States in October, 2003.
  • In 17th August 2005, Google acquired android Incorporation. Since then, it is in a subsidiary of Google Incorporation.
  • The key employees of Android Incorporation are Andy Rubin, Rich Miner, Chris White, and Nick Sears.
  • Originally intended for cameras but shifted to smartphones later because of low market for camera only.
  • Android is the nick name of Andy Rubin given by coworkers because of his love to robots.
  • In 2007, Google announces the development of android OS.
  • In 2008, HTC launched the first android mobile.


Android Versions, Codename and API

Version

Code name

API Level

1.5

Cupcake

3

1.6

Donut

4

2.1

Eclair

7

2.2

Froyo

8

2.3

Gingerbread

9 and 10

3.1 and 3.3

Honeycomb

12 and 13

4.0

Ice Cream Sandwitch

15

4.1, 4.2 and 4.3

Jelly Bean

16, 17 and 18

4.4

KitKat

19

5.0

Lollipop

21

6.0

Marshmallow

23

7.0

Nougat

24-25

8.0

Oreo

26-27



How To Install Android Studio On Windows 10


Basic Lesson 2 - Android Architecture and Software Stack 

android architecture or Android software stack is categorized into five parts:

android architecture
  1. Linux kernel
  2. native libraries (middleware),
  3. Android Runtime
  4. Application Framework
  5. Applications
















Linux kernel

It is the heart of android architecture that exists at the root of android architecture. Linux kernel is responsible for device drivers, power management, memory management, device management, and resource access.

Native Libraries

On the top of the Linux kernel, there are Native libraries such as WebKit, OpenGL, FreeType, SQLite, Media, C runtime library (libc), etc.

The WebKit library is responsible for browser support, SQLite is for database, Free Type for font support, and Media for playing and recording audio and video formats.

Android Runtime

In android runtime, there are core libraries and DVM (Dalvik Virtual Machine) which is responsible to run android applications.

DVM is like JVM but it is optimized for mobile devices. It consumes less memory and provides fast performance.


Android Framework

On top of Native libraries and android runtime, there is the Android framework. 

Android framework includes Android API such as UI (User Interface), telephony, resources, locations, Content Providers (data), and package managers. 

It provides a lot of classes and interfaces for android application development.

Applications

On the top of the Android framework, there are applications. 
All applications such as home, contact, settings, games, and browsers are using the android framework that uses android runtime and libraries.
Android runtime and native libraries are using the Linux kernel.


System Requirements to install Android Studio

Before downloading and installing Android Studio, the following requirements are essential.

  • Operating System Version - Microsoft Windows 7/8/10 (32-bit or 64-bit).
  • Random Access Memory (RAM) - A minimum of 4 GB RAM and 8 GB RAM are recommended.
  • Free Disk Space - Minimum 2 GB and 4 GB recommended.
  • Minimum Required JDK Version - Java Development Kit (JDK) 8.
  • Minimum Screen Resolution - 1280 * 800. resolution

The Android Studio user interface

  1. The toolbar lets you carry out a wide range of actions, including running your app and launching Android tools.
  2. The navigation bar helps you navigate through your project and open files for editing. It provides a more compact view of the structure visible in the Project window.
  3. The editor window is where you create and modify code. Depending on the current file type, the editor can change. For example, when viewing a layout file, the editor displays the Layout Editor.
  4. The tool window bar runs around the outside of the IDE window and contains the buttons that allow you to expand or collapse individual tool windows.
  5. The tool windows give you access to specific tasks like project management, search, version control, and more. You can expand them and collapse them.
The status bar displays the status of your project and the IDE itself, as well as any warnings or messages.


Basic Lesson 4 -Project Structure  to  Android Studio

Each project in Android Studio contains one or more modules with source code files and resource files. Types of modules include:



Android app modules
Library modules
Google App Engine modules
By default, Android Studio displays your project files in the Android project view, as shown in Figure 1. This view is organized by modules to provide quick access to your project's key source files.








Project files

By default, Android Studio displays your project files in the Android view. This view does not reflect the actual file hierarchy on disk but is organized by modules and file types to simplify navigation between key source files of your project, hiding certain files or directories that are not commonly used.

Some of the structural changes compared to the structure of the disk include the following:

  • Shows all the project's build-related configuration files in a top-level Gradle Script group.
  • Shows all manifest files for each module in a module-level group (when you have different manifest files for different product flavors and build types).
  • Shows all alternative resource files in a single group, instead of in separate folders per resource qualifier. For example, all density versions of your launcher icon are visible side-by-side.


The android project contains different types of app modules, source code files, and resource files. We will explore all the folders and files in the android app. 

  • Manifests Folder
  • Java Folder
  • res (Resources) Folder
  • Drawable Folder
  • Layout Folder
  • Mipmap Folder
  • Values Folder
  • Gradle Scripts


Manifests Folder

Manifests folder contains AndroidManifest.xml for our creating the android application. This file contains information about our application such as the Android version, metadata, states package for Kotlin file, and other application components. It acts as an intermediator between android OS and our application.
Following is the manifests folder structure in the android application. 


Java Folder


The Java folder contains all the java and Kotlin source code (.java) files that we create during the app development, including other Test files. If we create any new project using Kotlin, by default the class file MainActivity.kt file will create automatically under the package name “com.jerrytou.orasaunfoun” as shown below. 



Resource (res) folder

res/drawable folder 
It contains the different types of images used for the development of the application. We need to add all the images in a drawable folder for the application development.

res/layout folder
The layout folder contains all XML layout files which we used to define the user interface of our application. It contains the activity_main.xml file.


res/mipmap folder and res/values folder

res/mipmap folder
  • This folder contains launcher.xml files to define icons that are used to show on the home screen. It contains different density types of icons depending upon the size of the device such as hdpi, mdpi, xhdpi.
res/values folder
  • Values folder contains several XML files like strings, dimensions, colors, and style definitions. One of the most important files is the strings.xml file which contains the resources.

Gradle Scripts folder

Gradle means automated build system and it contains a number of files that are used to define a build configuration that can be applied to all modules in our application. In build.gradle (Project) there are buildscripts and in build.gradle (Module) plugins and implementations are used to build configurations that can be applied to all our application modules.



Basic Lesson 5 -Android Application Fundamental


Aplication Fundamental


An activity is the fundamental building block of an android app. It is just like a single screen with a user interface.

Activity is the main entry point of an android app just like the main method of a program written in java or C++.

An activity interacts with a user so it creates a window to place UI  elements. 

An android application can contain several activities means many different screens that can interact with each other.


Activity LifeCycles



Android activity has its own life cycle during its life in the android app.

 Activity is store an activity stack and managed in a stack called. 

The new activity comes at the top of the stack and becomes running, while the previous remains below the new activity in the stack.
When the top activity in the stack exits, the lower to the top becomes active.








Activity Life Cycles

Let's see the 7 lifecycle methods of android activity




























Basic Lesson 6 -Android Widgets


There are given a lot of android widgets with simplified examples such as Button, EditText, AutoCompleteTextView, ToggleButton, DatePicker, TimePicker, ProgressBar, etc.

Android Widgets -Android Button



Android Button, Let's learn how to perform event handling on button click.

Android Widgets - Android Toast

Android Toast, is used to show notifications for a particular interval of time. After some time it disappears. It doesn't block user interaction.
    
The android. widget. Toast class is the subclass of java. lang.Object class. You can also create custom toast as well for example toast displaying an image. You can visit the next page to see the code for custom toast.


Constants of Toast class There are only 2 constants of Toast class which are given below.












Methods of Toast class The widely used methods of Toast class are given below.











Android Widgets Custom Toast

Custom Toast, We are able to customize the toast, such as we can display images on the toast


Android Widgets ToggleButton

ToggleButton can be used to display the checked/unchecked (On/Off) state on the button.

It is beneficial if a user must change the setting between two states. It can be used for On/Off Sound, Wi-Fi, Bluetooth, etc.

Since Android 4.0, there is another type of toggle button called a switch that provides slider control.
Android ToggleButton and Switch both are the subclasses of CompoundButton class.


Android ToggleButton class
 ToggleButton class provides the facility of creating the toggle button.















XML Attributes of ToggleButton class. The 3 XML attributes of ToggleButton class.













Methods of ToggleButton class The widely used methods of ToggleButton class are given below.












Android Widgets-CheckBox

CheckBox,  is a type of two state button either checked or unchecked.

There can be a lot of usage of checkboxes. For example, it can be used to know the hobby of the user, activate/deactivate the specific action etc.

Android CheckBox class is the subclass of CompoundButton class.

Android CheckBox class
The android. widget.CheckBox class provides the facility of creating the CheckBoxes.





Methods of CheckBox class

There are many inherited methods of View, TextView, and Button classes in the CheckBox class. Some of them are as follows:








Android Widgets- Spinner

Spinner, Spinner displays multiple options, but only one can be selected at a time.




is like the combo box of AWT or Swing. It can be used to display multiple options to the user in which only one item can be selected by the user.
Android spinner is like the drop-down menu with multiple values from which the end user can select only one value.
Android spinner is associated with AdapterView. So, you need to use one of the adapter classes with a spinner.
Android Spinner class is the subclass of AsbSpinner class.




Android Widgets- AutoCompleteTextView

AutoCompleteTextView, Let's see the simple example of AutoCompleteTextView.
completes the word based on the reserved words, so no need to write all the characters of the word.

Android AutoCompleteTextView is an editable text field; it displays a list of suggestions in a drop-down menu from which the user can select only one suggestion or value.

Android AutoCompleteTextView is the subclass of EditText class. The MultiAutoCompleteTextView is the subclass of AutoCompleteTextView class.








Android Widgets- RatingBar

RatingBar, RatingBar displays the rating bar.
can be used to get the rating from the user. The Rating returns a floating-point number. It may be 2.0, 3.5, 4.0 etc.

Android RatingBar displays the rating in stars. Android RatingBar is the subclass of AbsSeekBar class.
The getRating() method of android RatingBar class returns the rating
number.



Android Widgets- DatePicker



DatePicker, Datepicker displays the date picker dialog that can be used to pick the date.
Android DatePicker is a widget to select dates. It allows you to select dates by day, month, and year. Like DatePicker, android also provides TimePicker to select a time.
The android.widget.DatePicker is the subclass of FrameLayout class.









Android Widgets- TimePicker

TimePicker, 
TimePicker displays the timepicker dialog that can be used to pick the.
widget is used to select a date. It allows you to select time by hour and minute. You cannot select time by seconds.
The android. widget.TimePicker is the subclass of FrameLayout class.






Basic Lesson 7 -Android Container 

There are given a lot of Android Container with simplified examples such as

Android ListView


Android ListView is a view that contains the group of items and displays in a scrollable list. ListView is implemented by importing the android. widget.ListView class. ListView is a default scrollable which does not use another scroll view.

ListView uses Adapter classes that add the content from a data sources (such as string array, array, database, etc) to ListView. Adapter bridges data between AdapterViews and other Views (ListView, ScrollView, etc).






Android Custom ListView (Adding Images, sub-title)

After creating a simple ListView, android also provides facilities to customize our ListView.

As the simple ListView, custom ListView also uses Adapter classes which added the content from data sources (such as string array, array, database, etc). Adapter bridges data between an AdapterViews and other Views









Android WebView 

Android WebView is used to display the web pages in android. The web page can be loaded from the same application or URL. It is used to display online content in android activity.

Android WebView uses the Webkit engine to display web pages.

The android.WebKit.WebView is the subclass of AbsoluteLayout class.
The loadUrl() and loadData() methods of the Android WebView class are used to load and display web pages.










Android TabLayout

TabLayout is used to implement horizontal tabs. TabLayout is released by Android after the deprecation of ActionBar.TabListener (API level 21).

TabLayout is introduced in the design support library to implement tabs.
Tabs are created using the newTab() method of TabLayout class. The title and icon of Tabs are set through setText(int) and setIcon(int) methods of the TabListener interface respectively. Tabs of layout are attached over TabLayout using the method addTab(Tab) method.







Android SearchView

Android SearchView provides a user interface to search queries submitted over the search provider. SearchView widget can be implemented over ToolBar/ActionBar or inside a layout.
SearchView is by default collapsible and set to be iconified using the setIconifiedByDefault(true) method of SearchView class. For making search field visible, SearchView uses setIconifiedByDefault(false) method.

Methods of SearchView
public boolean onQueryTextSubmit(String query): It searches the query on the submission of content over the SearchView editor. It is case-dependent.
public boolean onQueryTextChange(String newText): It searches the query at the time of text change over the SearchView editor.




Android Menu

There are given a lot of Android Menu with simplified examples such as
  • Android Option Menus 
  • Android Context Menu
  • Android Popup

Basic Lesson 8-Android Option Menu

Android Option Menus are the primary menus of android. They can be used for settings, searching, deleting items, etc.

Here, we are going to see two examples of option menus. First, the simple option menus, and second, options menus with images.
Here, we are inflating the menu by calling the inflate() method of MenuInflater class. To perform event handling on menu items, you need to override onOptionsItemSelected() method of Activity class.











Android Context Menu

The android context menu appears when the user presses long clicks on the element. It is also known as a floating menu.
It affects the selected content while doing action on it.
It doesn't support item shortcuts and icons.













Android Popup Menu

Android Popup Menu displays the menu below the anchor text if space is available otherwise above the anchor text. It disappears if you click outside the popup menu.
The android. widget.PopupMenu is the direct subclass of java. lang.Object class.


Popular posts from this blog

Orasaun Ruma Applications

 About my Orasaun Ruma Applications

Cristo Rei of Dili

  Cristo Rei of Dili   e then Indonesian province. (Christ the King of Dili) is a 27.0-meter-high (88.6 ft) statue of Jesus located atop a globe in Dili, East Timor. The statue was designed by Mochamad Syailillah, who is better known as Boil. The statue was officially unveiled by Soeharto in 1996 as a gift from the Indonesian Government to the people of Timor Timur. The statue, and the globe on which it rests, are situated at the end of the Fatucama peninsula, facing out to the ocean, and can be reached by climbing some 597 steps. Question time  When was Cristo Rei Dili built?                1996                 This 89-foot statue of Cristo Rei was constructed in 1996 as a present from                                     Indonesia to East Timor. ...

Konstituisaun RDTL App

Konstituisaun RDTL App Livru manual konstituisaun RDTL ne’ebe mak Estadu Timor Leste Aprova iha 2002 to’o ohin loron membru Governu hanaran Lei Inan atu sidadaun Timor Leste bele lao tuir no banati tuir. Maibe livru manual ida ne’e seidauk sufsiente ba timor oan hotu atu lé no kompriende diak konaba kostituisaun ida ne’e tantu iha rai laran no mos iha rai liur tamba menus husi livru Digitalizasaun. Ho desafius hirak ne’ebe mak ita hasoru ona  Hau mai ho solusaun ida kria Aplikasaun Konstituisaun RDTL  offline ida  atu nune’e ba ita iha ne’ebe deit bele asesu iha telemovel rasik para hodi labele lakon tan, no hodi ita la presija lori tun sae Kaner wanhira ita presija, no ba maluk sira iha railaran laran no mos iha rain Liur no mos maluk Estrangeiru sira fasil atu utiliza no hodi bele hatene ita nia konstituisaun para ser labele halo arbiru iha ita nia rai doben Timor Lorosae. Termu Privasidade ba Applikasaun At...