Training Programme on Digital Technologies from “17th to
21st January,
2017 at APHRDI , Bapatla”
Brief details
of learning at the training programme
What is Android?
• ANDROID is a Linux-based operating
system designed for touch screen mobile devices such as smartphones and tablet
PC.
• Now a day’s ANDROID is one of the most popular mobile OS.
Developed by Google and later the Open Handset Alliance (OHA).
• ANDROID has its own virtual machine i.e.
DVM(Dalvik Virtual Machine),which is used for executing the android
application.
• ANDROID platform is a platform that
provides tools and technologies which can used to develop and build mobile
Applications.
• ANDROID applications are usually
developed in the Java language using the Android Software Development Kit.
Versions of Android
• Alpha - Android 1.0 (API level- 1)
• Beta Android 1.1 (API level- 2)
• Cupcake - Android 1.5 (API level- 3)
• Donut - Android 1.6 (API level- 4)
• Eclairs - Android 2.0-2.1 (API level- 5
to 7)
• Froyo - Android 2.2-2.2.3 (API level- 8)
• Gingerbread - Android 2.3-2.3.7 (API
level- 9 to 10)
• Honeycomb - Android 3.0-3.2.6 (API
level- 11 to 13)
• IceCreamSandwitch - Android 4.0-4.0.4
(API level- 14 to 15)
• Jellybean - Android 4.1-4.3.1 (API
level- 16 to 18)
• KitKat - Android 4.4-4.4.4 (API level-
19)
• Lollipop - Android 5.0-5.1.1 (API level-
21 to 22)
• Marshmallow – Android 6.0-6.0.1 (API level- 23)
• Nougat - Android 7.0-7.0.1 (API level-
24 to 25)
Types of Android Apps
• Social - (WhatsApp, Facebook, LinkedIn,
etc…)
• Entertainment (Digital Music, Adele,
BigTV, Hot Star, etc…)
• Games
(Grand Theft Auto Theft, Flick Soccer, Temple Run, Candy Crush, etc…)
• Reading
(BBC News, Pulse News, The Guardian, etc…)
• LifeStyle
Android Auto
• Android Auto is a smartphone projection standard developed by Google
to allow mobile devices running the Android operating system (version 5.0
"Lollipop" and later) to be operated in automobiles through the
dashboard's head unit.
• Android Auto was designed with safety in mind. With a simple and
intuitive interface, integrated steering wheel controls, and powerful new voice
actions, it's designed to minimize distraction so you can stay focused on the
road.
• Android Auto is Google's solution for bringing the power of your
smartphone to the relatively dumb nature of vehicle infotainment.
• The standard offers drivers control over GPS mapping/navigation,
music playback, SMS, telephony, and web search
• Both touchscreen and button-controlled head unit displays will be
supported, although hands-free operation through voice commands is emphasized
to ensure safe driving.
• The aim of Android Auto is to extend the functionality of an Android
mobile device in an automobile to the dashboard's head unit.
• Android Auto is Google's solution for bringing the power of your
smartphone to the relatively dumb nature of vehicle infotainment.
• Basically you're using your phone to broadcast a new user interface
onto your car's touchscreen, thus bringing the full power of the latest phones
to your car.
• The standard offers drivers control over GPS mapping/navigation,
music playback, SMS, telephony, and web search.
What You Need??
• To use Android Auto, you need an Android Auto compatible vehicle or
aftermarket radio and an Android phone running 5.0 (Lollipop) or higher.
• When you connect your Android phone to the compatible vehicle or
radio, Android Auto will display applications on the vehicle’s screen.
• For more information about Android Auto compatibility, please visit
support.google.com/androidauto
Android Studio:- Installation Process
• You can start Android Application Development on Operating System
like Windows, Mac OS, Linux.
• All the required tools to develop Android applications are freely
available and can be downloaded from the Web. Following is the list of software's
you will need before you start your Android application programming.
• Java JDK7 or JDK8
• Java Runtime Environment(JRE)
• Android Studio
Launch Android Studio.exe,Make
sure before launch Android Studio, Our Machine should required installed Java
JDK. To install Java JDK,take a references of Android
environment setup

Once you launched Android Studio, it’s time
to mention JDK7 path or later version in android studio installer.

Initiate JDK to android SDK

Need to check the components, which are
required to create applications, below the image has selected Android
Studio, Android SDK, Android Virtual Machine and performance(Intel
chip).

Need to specify the location of local
machine path for Android studio and Android SDK

Need to specify the ram space for Android
emulator by default it would take 512MB of local machine RAM.

At final stage, it would extract SDK
packages into our local machine, it would take a while time to finish the task
and would take 2626MB of Hard disk space

After done all above steps perfectly, you
must get finish button and it going to be open android studio project with Welcome
to android studio message as shown below

You can start your application development
by calling start a new android studio project. in a new installation frame
should ask Application name, package information and location of the project

After entered application name, it going to
be called select the form factors your application runs on, here need to
specify Minimum SDK

The next level of installation should
contain selecting the activity to mobile, it specifies the default layout for
Applications

At the final stage it going to be open
development tool to write the application code.

Create
Android Virtual Device
After Click on a virtual device icon, it
going to be shown by default virtual devices which are present on your SDK, or
else need to create a virtual device by clicking Create new Virtual
device button

HelloWorld
Example
Before Writing a Hello word code, you must
know about XML tags. To write hello word code, you should redirect to App>res>layout>Activity_main.xml

String File :-
The
strings.xml file is located in the res/values folder and it
contains all the text that your application uses. For example, the names of
buttons, labels, default text, and similar types of strings go into this file.
This file is responsible for their textual content
<resources>
<string
name="app_name">HelloWorld</string> <string
name="hello_world">Hello world!</string> <string
name="menu_settings">Settings</string> <string
name="title_activity_main">MainActivity</string>
</resources>
activity_main.xml(layout file)
To show hello word, we need to call text
view with layout ( about text view and layout, you must take references
at Relative
Layout and Text
View ).
<RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent“
android:paddingLeft="@dimen/activity_horizontal_margin“
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin“
android:paddingBottom="@dimen/activity_vertical_margin“
tools:context=".MainActivity">
<TextView
android:text="@string/hello_world“
android:layout_width="550dp"
android:layout_height="wrap_content"
/>
</RelativeLayout>
MainActivity.java
The
main activity code is a Java file MainActivity.java. This is the actual
application file which ultimately gets converted to a Dalvik executable and
runs your application
package com.example.helloworld;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;
public class MainActivity extends Activity
{
@Override
public void onCreate(BundlesavedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main,
menu);
return true;
Need to run the program by clicking Run>Run
App or else need to call shift+f10key. Finally, result
should be placed at Virtual devices as shown below

Application Components
• Application components are the essential building blocks of an
Android application.
• These components are loosely coupled by the application manifest
file AndroidManifest.xml that describes each component of the
application and how they interact.
• There are following four main components that can be used within an
Android application:
Ø Activities : They dictate the UI and
handle the user interaction to the smartphone screen
Ø Services :They handle background
processing associated with an application.
Ø Broadcast Receivers : They handle
communication between Android OS and applications.
Ø Content Providers : They handle data and
database management issues.
• Activity
An activity
represents a single screen with a user interface. For example, an email
application might have one activity that shows a list of new emails, another
activity to compose an email, and another activity for reading emails. If an
application has more than one activity, then one of them should be marked as
the activity that is presented when the application is launched.
• An activity is implemented as a subclass of Activity class as
follows:
public class MainActivity extends Activity {
}
• Other components of Android Application
Resources
Manifest
Layout
Intents
Fragment
Views
Android Resources
Resources like static content that your code uses, such as bitmaps, colors,
layout definitions, user interface strings, animation instructions, and more.
These resources are always maintained separately in various sub-directories
under res/ directory of the project.
You should place each type of resource in a specific
subdirectory of your project's res/ directory.
MyProject/
src/
MyActivity.java
res/
drawable/
icon.png
layout/
activity_main.xml
info.xml
values/
string
The res/ directory
contains all the resources in various subdirectories. Here we have an image
resource, two layout resources, and a string resource file.
anim/ :-
XML files that define property
animations. They are saved in res/anim/ folder and accessed from the R.anim class.
color/ :-
XML files that define a state list of
colors. They are saved in res/color/ and accessed from the R.color class.
drawable/ :-
Image files
like .png, .jpg, .gif or XML files that are compiled into bitmaps, state lists,
shapes, animation drawables. They are saved in res/drawable/ and accessed from
the R.drawable class.
layout/ :-
XML files that define a user
interface layout. They are saved in res/layout/ and accessed from the R.layout
class.
menu/ :-
XML files that define application
menus, such as an Options Menu, Context Menu, or Sub Menu. They are saved in
res/menu/ and accessed from the R.menu class.
values/ :-
XML files that contain simple values, such as
strings, integers, and colors. For example, here are some filename conventions
for resources you can create in this directory:
ü arrays.xml for resource
arrays, and accessed from the R.array class.
ü integers.xml for
resource integers, and accessed from the R.integerclass.
ü bools.xml for resource
boolean, and accessed from the R.bool class.
ü colors.xml for color
values, and accessed from the R.color class.
ü dimens.xml for
dimension values, and accessed from the R.dimen class.
ü strings.xml for string
values, and accessed from the R.string class.
ü styles.xml for styles,
and accessed from the R.style class.
xml/ :-
Arbitrary XML files that can be read at run time by
calling Resources.getXML(). You can save various configuration files
here which will be used at run time.
Manifest
Whatever component you
develop as a part of your application, you must declare all its components in a
manifest file called AndroidManifest.xml which resides at the
root of the application project directory. This file works as an interface
between Android OS and your application, so if you do not declare your
component in this file, then it will not be considered by the OS.
Website
links to learn
M.JOHN JOSEPH, L/ECE, GP Addanki