Index: -
[Link]. Experiment Name Remarks
1. Installation of Java, android Framework
2. Android SDK Manager and its all components
3. Programs based on the overriding, constructor, classes in Java
4. Programs based on the Final, this and static keyword in Java
5. Directory Structure of an Android Project, Common Default Resources
Folders, The Values Folder, Leveraging Android XML
6. Applications based on Text Boxes and Button
7. Applications based on Check Boxes and button
8. Applications based on Radio Buttons
9. Applications based on Intents and Intent Filters
10. Applications based on Activities and services
11. Applications based on Action Bar
12. Applications based on Option Menu
13. Applications based on Rating Bar
14. Applications based on Media Player
15. Applications based on Content Providers
16. Applications based on accessing camera
17. Applications based on accessing location
18. Applications based on the activation of sensors
19. Applications based on Animations
Practical No. 1: - Installation of Java, android Framework
Installation of Java: -
Step 1: Verify that it is already installed or not
Check whether Java is already installed on the system or not. In my case, it is not installed therefore I need to
install JDK 1.8 on my computer.
Step 2: Download JDK
Click the below link to download jdk 1.8 for you windows 64bit system. Download JDK For Windows
There are available releases for Linux and mac operating systems.
Step 3: Install JDK
Open the executable file which you have just downloaded and follow the steps.
Click Next to continue
Just Choose Development Tools and click Next.
Set up is being ready.
Choose the Destination folder in which you want to install JDK. Click Next to continue with the installation.
Set up is installing Java to the computer.
We have successfully installed Java SE development kit 8. Close the installation set up.
Step 4 : Set the Permanent Path
To execute Java applications from command line, we need to set Java Path. To set the path, follow the following
steps.
Right click on "this PC". It can be named as "My Computer" in some systems. Choose "properties" from the
options.
The screen look alike the above image will open. Click on "Advanced system settings" to continue
Above window will open. Click on "Environment Variables" to continue.
Enter "path" in variable name and enter the path to the bin folder inside your JDK in the variable value. Click
OK.
Now Java Path has been set up. Open the Command prompt and type "javac" In case you have already open
up the command prompt, I suggest you to close the existing window and reopen it again.
We will get javac executed as shown in the image below.
The Java has been installed on our system.
Installation of Android Framework : -
Step 1: Head over to this link to get the Android Studio executable or zip file.
Step 2: Click on the Download Android Studio Button.
Click on the “I have read and agree with the above terms and conditions” checkbox followed by the
download button.
Click on the Save file button in the appeared prompt box and the file will start downloading.
Step 3: After the downloading has finished, open the file from downloads and run it. It will prompt the
following dialog box.
Click on next. In the next prompt, it’ll ask for a path for installation. Choose a path and hit next.
Step 4: It will start the installation, and once it is completed, it will be like the image shown below.
Click on next.
Step 5: Once “Finish” is clicked, it will ask whether the previous settings need to be imported [if the android
studio had been installed earlier], or not. It is better to choose the ‘Don’t import Settings option’ .
Click the OK button.
Step 6: This will start the Android Studio.
Meanwhile, it will be finding the available SDK components.
Step 7: After it has found the SDK components, it will redirect to the Welcome dialog box.
Click on Next.
Choose Standard and click on Next. Now choose the theme, whether the Light theme or the Dark one. The
light one is called the IntelliJ theme whereas the dark theme is called Dracula. Choose as required.
Click on the Next button.
Step 8: Now it is time to download the SDK components.
Click on Finish. Components begin to download let it complete.
The Android Studio has been successfully configured. Now it’s time to launch and build apps. Click on the
Finish button to launch it.
Step 9: Click on Start a new Android Studio project to build a new app.
Practical No. 2: - Android SDK Manager and its all components.
About Android SDK:
Android SDK is a collection of libraries and Software Development tools that are essential for Developing
Android Applications. Whenever Google releases a new version or update of Android Software, a
corresponding SDK also releases with it. In the updated or new version of SDK, some more features are
included which are not present in the previous version. Android SDK consists of some tools which are very
essential for the development of Android Application. These tools provide a smooth flow of the
development process from developing and debugging. Android SDK is compatible with all operating systems
such as Windows, Linux, macOS, etc.
Components of Android SDK
Android SDK Components play a major role in the Development of Android
applications. Below are the important components:
1. Android SDK Tools
Android SDK tool is an important component of Android SDK. It consists of a
complete set of development and debugging tools. Below are the SDK
developer tools:
Android SDK Build tool.
Android Emulator.
Android SDK Platform-tools.
Android SDK Tools.
These are shown
below :
2. Android SDK Build-Tools
Android SDK build tools are used for building actual binaries of Android App. The main functions of Android
SDK Build tools are built, debug, run and test Android applications. The latest version of the Android SDK
Build tool is 30.0.3. While downloading or updating Android in our System, one must ensure that its latest
version is download in SDK Components.
3. Android Emulator
An Android Emulator is a device that simulates an Android device on your system. Suppose we want to run our
android application that we code. One option is that we will run this on our Android Mobile by Enabling USB
Debugging on our mobile. Another option is using Android Emulator. In Android Emulator the virtual
android device is shown on our system on which we run the Android application that we code.
Thus, it simply means that without needing any physical device Android SDK component “Android Emulator”
provides a virtual device on the System where we run our Application. The emulator’s come with the
configuration for Various android phones, tablets, Wear OS, and Android TV devices.
In Android Virtual Emulator all functions that are feasible on real Android mobile is works on virtual Device like:
phone calls, text messages.
stimulate different network speeds.
specify the location of a device
access on google play store and lot’s more.
But there is one disadvantage of this emulator is that. It is very slow when System’s PC has less RAM. It
works fine when a maximum GB of RAM is present on our device.
4. Android SDK Platform-tools
Android SDK Platform-tools is helpful when we are working on Project and they will show the error
messages at the same time. It is specifically used for testing. It includes:
Android Debug Bridge (ADB), is a command-line tool that helps to communicate with the device. It
allows us to perform an action such as Installing App and Debugging App etc.
Fastboot allows you to flash a device with a new system image.
Systrace tools help to collect and inspect timing information. It is very crucial for App Debugging.
5. Android SDK Tools
Android SDK tool is a component of SDK tool. It consists of a set of tools which and other Utilities which are
crucial for the development of Android Application. It contains the complete set of Debugging and
Development tools for android.
6. SDK Platforms
For Each Android Software, one SDK platform is available as shown below:
Like in this Android 11.0(R) is installed.
These are numbered according to the android version. The new version of the SDK platform has more
features and more compatible but the old version is less compatible with fewer features. Like in Android
11.0(R) have more compatible and have more feature but the below versions like Android 10.0(Q),
Android4.4(KitKat) have less feature and is less compatible.
7. SDK Update Sites
In SDK Update Sites, some sites are embedded in it which will check for Android SDK Updates Tools. In this,
one must ensure we don’t unclick the button below because these are checked by default which will check
for updates if we will unclick it then it doesn’t check updates for those.
Practical No. 3 : - Programs based on the overriding, constructor, classes in Java
Method Overriding in Java
//Java Program to illustrate the use of Java Method Overriding
//Creating a parent class.
class Vehicle{
//defining a method
void run(){[Link]("Vehicle is running");}
}
//Creating a child class
class Bike2 extends Vehicle{
//defining the same method as in the parent class
void run(){[Link]("Bike is running safely");}
public static void main(String args[]){
Bike2 obj = new Bike2();//creating object
[Link]();//calling method
}
}
Output:
default constructor
//Java Program to create and call a default constructor
class Bike1{
//creating a default constructor
Bike1()
{[Link]("Bike is created");
}
public static void main(String args[])
{ Bike1 b=new Bike1();
}
}
Practical No. 4: - Programs based on the Final, this and static keyword in Java
Final Keyword In Java
class Bike9{
final int speedlimit=90;//final variable
void run(){
speedlimit=400;
}
public static void main(String args[])
{ Bike9 obj=new Bike9();
[Link]();
}
}//end of class
Output:
Java static keyword
/Java Program to get the cube of a given number using the static method
class Calculate{
static int cube(int x)
{ return x*x*x;
}
public static void main(String args[]){
int result=[Link](5);
[Link](result);
}
}
Output: -
this keyword in Java
class A{
void m(){[Link]("hello m");}
void n(){
[Link]("hello n");
//m();//same as this.m()
this.m();
}
}
class TestThis4{
public static void main(String args[])
{ A a=new A();
a.n();
}}
Output: -
Practical No. 5: - Directory Structure of an Android Project, Common Default Resources Folders, The Values
Folder, Leveraging Android XML.
Android Project folder Structure: Android Studio is the official IDE (Integrated Development Environment)
developed by the JetBrains community which is freely provided by Google for android app development. After
completing the setup of Android Architecture we can create an android application in the studio. We need to
create a new project for each sample application and we should understand the folder structure. It looks like
this:
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.
1. Manifests Folder
2. Java Folder
3. res (Resources) Folder
Drawable Folder
Layout Folder
Mipmap Folder
Values Folder
4. Gradle Scripts
Manifests Folder
Manifests folder contains [Link] for creating our 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
[Link] file will create automatically under the package name “[Link]”
as shown below.
Resource (res) folder
The resource folder is the most important folder because it contains all the non-code sources like images,
XML layouts, and UI strings for our android application.
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
This folder contains [Link] 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 a number of XML files like strings, dimensions, colors, and style definitions. One of
the most important files is the [Link] 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 [Link] (Project) there are
buildscripts and in [Link] (Module) plugins and implementations are used to build configurations that
can be applied to all our application modules.
Practical No. 6: - Applications based on Text Boxes and Button
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="[Link]">
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="61dp"
android:ems="10"
android:inputType="number"
tools:layout_editor_absoluteX="84dp"
tools:layout_editor_absoluteY="53dp" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:ems="10"
android:inputType="number"
tools:layout_editor_absoluteX="84dp"
tools:layout_editor_absoluteY="127dp" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText2"
android:layout_centerHorizontal="true"
android:layout_marginTop="109dp"
android:text="ADD"
tools:layout_editor_absoluteX="148dp"
tools:layout_editor_absoluteY="266dp" />
</RelativeLayout>
Output: -
Practical No7: - Applications based on Check Boxes and button.
<?xml version="1.0" encoding="utf-8"?>
<[Link] xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="[Link]">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="144dp"
android:layout_marginTop="68dp"
android:text="Pizza"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="144dp"
android:layout_marginTop="28dp"
android:text="Coffee"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBox" />
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="144dp"
android:layout_marginTop="28dp"
android:text="Burger"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBox2" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="144dp"
android:layout_marginTop="184dp"
android:text="Order"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBox3" />
</[Link]>
Output: -
Practical No8: - Applications based on Radio Buttons
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="[Link]">
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center_horizontal"
android:textSize="22dp"
android:text="Single Radio Buttons" />
<!-- Default RadioButtons -->
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Radio Button 1"
android:layout_marginTop="20dp"
android:textSize="20dp" />
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Radio Button 2"
android:layout_marginTop="10dp"
android:textSize="20dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginTop="20dp"
android:background="#B8B894" />
<TextView
android:id="@+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center_horizontal"
android:textSize="22dp"
android:text="Radio button inside RadioGroup" />
<!-- Customized RadioButtons -->
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/radioGroup">
<RadioButton
android:id="@+id/radioMale"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Male"
android:layout_marginTop="10dp"
android:checked="false"
android:textSize="20dp" />
<RadioButton
android:id="@+id/radioFemale"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Female"
android:layout_marginTop="20dp"
android:checked="false"
android:textSize="20dp" />
</RadioGroup>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Selected"
android:id="@+id/button"
android:onClick="onclickbuttonMethod"
android:layout_gravity="center_horizontal" />
</LinearLayout>
Output: -
Practical No9: - Applications based on Intents and Intent Filters.
<?xml version="1.0" encoding="utf-8"?>
<[Link] xmlns:android="[Link]
ndroid"
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="[Link]">
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="60dp"
android:ems="10"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.575"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_marginLeft="156dp"
android:layout_marginTop="172dp"
android:text="Visit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText" />
</[Link]>
Output: -
Practical No10: - Applications based on Activities and services
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="[Link]">
<Button
android:id="@+id/buttonStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="74dp"
android:text="Start Service" />
<Button
android:id="@+id/buttonStop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Stop Service" />
<Button
android:id="@+id/buttonNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="63dp"
android:text="Next Page" />
</RelativeLayout>
activity_next.xml
<?xml version="1.0" encoding="utf-8"?>
<[Link] xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="[Link]">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="200dp"
android:text="Next Page"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</[Link]>
File: [Link]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="[Link]
package="[Link]">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="[Link]" />
<category android:name="[Link]" />
</intent-filter>
</activity>
<activity android:name=".NextPage"></activity>
<service
android:name=".MyService"
android:enabled="true" />
</application>
</manifest>
Output: -
Practical No 11: - Applications based on Action Bar
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="[Link]
xmlns:android="[Link]
<!-- action button for search -->
<item android:title="search"
android:id="@+id/search"
android:orderInCategory="100"
app:showAsAction="ifRoom"
android:icon="@drawable/search_icon"/>
<!-- action button for refresh -->
<item android:title="refresh"
android:id="@+id/refresh"
android:orderInCategory="100"
app:showAsAction="ifRoom"
android:icon="@drawable/refresh_icon"/>
<!-- action button for copy -->
<item android:title="copy"
android:id="@+id/copy"
android:orderInCategory="100"
app:showAsAction="never"
android:icon="@drawable/copy_icon"/>
</menu>
Output: -
Practical No 12: - Applications based on Option Menu
File: activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<[Link] xmlns:android="[Link]
roid"
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="[Link]">
<[Link]
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/[Link]">
<[Link]
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/[Link]" />
</[Link]>
<include layout="@layout/content_main" />
</[Link]>
File: context_main.xml
<?xml version="1.0" encoding="utf-8"?>
<[Link] xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="[Link]"
tools:showIn="@layout/activity_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</[Link]>
File: menu_main.xml
<menu xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
tools:context="[Link]">
<item android:id="@+id/item1"
android:title="Item 1"/>
<item android:id="@+id/item2"
android:title="Item 2"/>
<item android:id="@+id/item3"
android:title="Item 3"
app:showAsAction="withText"/>
</menu>
Output: - The output is shown in the next page.
Practical No.13: - Applications based on Rating Bar
<?xml version="1.0" encoding="utf-8"?>
<[Link] xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="[Link]">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="submit"
android:id="@+id/button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.615" />
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_marginTop="60dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</[Link]>
Output: -
Practical No 14 : - Applications based on Media Player
<RelativeLayout xmlns:androclass="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:text="Audio Controller" />
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="48dp"
android:text="start" />
<Button
android:id="@+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/button1"
android:layout_toRightOf="@+id/button1"
android:text="pause" />
<Button
android:id="@+id/button3"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/button2"
android:layout_toRightOf="@+id/button2"
android:text="stop" />
</RelativeLayout>
Output: -
Practical No 15: - Applications based on Content Providers
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#168BC34A"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/imageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.13"
tools:ignore="MissingConstraints">
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="70dp"
android:fontFamily="@font/roboto"
android:text="@string/heading"
android:textAlignment="center"
android:textAppearance="@style/[Link]"
android:textColor="@android:color/holo_green_dark"
android:textSize="36sp"
android:textStyle="bold" />
<Button
android:id="@+id/loadButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:background="#4CAF50"
android:fontFamily="@font/roboto"
android:onClick="onClickShowDetails"
android:text="@string/loadButtonText"
android:textAlignment="center"
android:textAppearance="@style/[Link].Display1"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<TextView
android:id="@+id/res"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:clickable="false"
android:ems="10"
android:fontFamily="@font/roboto"
android:textColor="@android:color/holo_green_dark"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/banner" />
</[Link]>
Output: - The output is shown in the next page.
Practical No 16: - Applications based on accessing camera
<RelativeLayout xmlns:androclass="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Take a Photo" >
</Button>
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/button1"
android:layout_alignParentTop="true"
android:src="@drawable/ic_launcher" >
</ImageView>
</RelativeLayout>
Output: - The output is shown in the next page.
Practical No 17: - Applications based on accessing location
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="[Link]
package="[Link]">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="[Link].ACCESS_FINE_LOCATION" />
<uses-permission android:name="[Link].ACCESS_COARSE_LOCATION" />
<uses-permission android:name="[Link]" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="[Link].API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="[Link]" />
<category android:name="[Link]" />
</intent-filter>
</activity>
</application>
</manifest>
Output: -
Practical No 18: Applications based on the activation of sensors
<RelativeLayout xmlns:androclass="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="92dp"
android:layout_marginTop="114dp"
android:text="TextView" />
</RelativeLayout>
Output: -
Practical No 19: - Applications based on Animations
<RelativeLayout xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<View />
</RelativeLayout>
File: [Link]
Have a image view only.
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/anm">
</ImageView>
Output: -