Attempt Any FIVE of The Following:: A) Define OHA and State Goal of OHA
Attempt Any FIVE of The Following:: A) Define OHA and State Goal of OHA
------------------------------------------------------------------------------------------------------------------------------------------
ANS :→ 1. Near Field Communication (NFC): Most Android devices support NFC, which allows electronic
devices to interact across short distances easily. The main goal here is to create a payment option that is
simpler than carrying cash or credit cards, and while the market hasn't exploded as many experts had
predicted, there may be an alternative in the works, in the form of Bluetooth Low Energy (BLE).
2. Infrared Transmission: The Android operating system supports a built-in infrared transmitter that allows
you to use your phone or tablet as a remote control.
3. Automation: The Tasker app allows control of app permissions and also automates them.
4. Wireless App Downloads: You can download apps on your PC by using the Android Market or third-
party options like AppBrain. Then it automatically syncs them to your Droid, and no plugging is required.
5. Storage and Battery Swap: Android phones also have unique hardware capabilities. Google's OS makes
it possible to upgrade, replace, and remove your battery that no longer holds a charge. In addition, Android
phones come with SD card slots for expandable storage.
6. Custom Home Screens: While it's possible to hack certain phones to customize the home screen,
Android comes with this capability from the get-go. Download a third-party launcher like Apex, Nova, and
you can add gestures, new shortcuts, or even performance enhancements for older-model devices.
ANS :→ Generally Android tools are not platform dependent and are required on every Android Platform,
no matter which you use. While we install AndroidStudio, there are some sets of tools that automatically
get installed. Those set of tools are explained below for you
1. Android Tool: This tool helps in managing the Android Virtual Device projects as well as the installed
components of the software development kit.
2. Emulator Tool: It helps us in testing the applications without the need of using the application on an
actual device.
4. Android Debug Bridge(adb): It is a very versatile command-line tool and is helpful for the
communication between the developer and the Emulator or the Android device that is connected.
5. Proguard: Proguard is the tool responsible for shrinking, and optimizing our code. It does this, by
removing the unused code or the codes that are unreachable.
1. Operating System
2. Application
3. End-User
Since Android is primarily focused on the end user, the system has to be secure by default.
The user expects the other two parties to have taken the necessary measures to ensure his safety.
However, when the nature of the action requires his consent, the end-user is the decisive factor when it
comes to the security of the overall system.
For the rest of the article, we will explore the security measures enforced by the three parties in order to
prevent malicious actions from being successfully executed.
The kernel is the core operating system software that handles the CPU resources, the system memory, the
system devices, including the file systems and networking, and is responsible for managing all the processes.
It serves as a link between the software and the hardware.
However, with great power comes great responsibility. The kernel security determines the overall security
of the whole system.
Android’s kernel is based on the Linux kernel’s long-term support (LTS) branches. The decades of
continuous improvement have established Linux as a stable and reliable kernel amongst many businesses
and security professionals.
The security of the Android operating system is based around the following key security features of the
Linux kernel:
Process Isolation
d) Elaborate the need of permissions in Android. Explain the permissions to set system
functionalities like SEND-SMS, bluetooth.
ANS :→
Date picker:
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="102dp"
android:layout_marginLeft="30dp"
android:layout_marginStart="30dp"
android:text="" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:text="Change Date" />
<DatePicker
android:id="@+id/datePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="36dp" />
</RelativeLayout>
Time picker:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="example.javatpoint.com.timepicker.MainActivity">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="102dp"
android:layout_marginLeft="30dp"
android:layout_marginStart="30dp"
android:text="" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:text="Change Time" />
<TimePicker
android:id="@+id/timePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="36dp" />
</RelativeLayout>
b) Explain the steps to install and configure Android studio and SDK.
ANS :→Installation Guide
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.
To run your first android app in Android Studio you may refer to Running your first Android app.
By the help of activity, you can place all your UI components or widgets in a single screen.
The 7 lifecycle method of Activity describes how activity will behave at different states.
Method Description
onResume called when activity will start interacting with the user.
Step 2: After you completed step 1 you will be redirected to this page where you have to click on
the CREATE APPLICATION button.
Once you click on it a pop up will be shown like this where you have to choose your Default
language and Title of your app. Then click on the CREATE button.
Step 3: Store listing
After you completed step 2 you will be redirected to this page where you have to provide the Short
description and Full description of your App.
Then you scroll down the page and now you have to add the Hi-res icon of your app. Then you have to
provide the Screenshots of your app.Ant next thing you have to provide is the Feature Graphic of your
app. Note that this graphic is then used everywhere your app is featured on Google Play.
Then come to Categorization part where you have to provide your Application type and Category of
your app.
Then come to Contact details part where you have to provide your Website(if any), email, and Phone of
yours.
And finally when you click on SAVE DRAFT button you can see that Store listing tab is now become
turned to green and you are done for Store listing.
The growing dependence of many businesses on web applications and mobile applications has led many
companies to place increased priority on UI in an effort to improve the user's overall experience.
computer mouse
remote control
virtual reality
ATMs
speedometer
the old iPod click wheel
Websites such as Airbnb, Dropbox and Virgin America display strong user interface design. Sites like these
have created pleasant, easily operable, user-centered designs (UCD) that focus on the user and their
needs.
UI and UX
The UI is often talked about in conjunction with user experience (UX), which may include the aesthetic
appearance of the device, response time and the content that is presented to the user within the context
of the user interface. Both terms fall under the concept of human-computer interaction (HCI), which is the
field of study focusing on the creation of computer technology and the interaction between humans and all
forms of IT design. Specifically, HCI studies areas such as UCD, UI design and UX design.An increasing focus
on creating an optimized user experience has led some to carve out careers as UI and UX experts. Certain
languages, such as HTML and CSS, have been geared toward making it easier to create a strong user
interface and experience
ANS :→
<RelativeLayout xmlns:androclass="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="116dp"
android:text="download file" />
</RelativeLayout>
Application Framework
Application
Android Runtime
Platform Libraries
Linux Kernel
Pictorial representation of android architecture with several main components and
their sub components –
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/editTextRecipient"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Recipient" />
<EditText
android:id="@+id/editTextSubject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Subject" />
<EditText
android:id="@+id/editTextBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Body"
android:inputType="textMultiLine"
android:lines="5" />
<Button
android:id="@+id/buttonSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<TextView
android:id="@+id/textViewReceivedEmails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Received Emails"
android:textSize="18sp"
android:textStyle="bold" />
<ListView
android:id="@+id/listViewReceivedEmails"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
b) Develop a program for providing bluetooth connectivity.
ANS :→
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bluetoothexample">
<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>
</intent-filter>
</activity>
<service
android:name=".BluetoothService"
android:enabled="true"
android:exported="false" />
</application>
</manifest>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="4"
android:rowCount="4">
android:id="@+id/button1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button3"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button4"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button5"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button6"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button7"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button8"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button9"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button10"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
<Button
android:id="@+id/button11"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight
<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: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">
<ImageView
android:id="@+id/imageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/my_image"
android:scaleType="centerCrop" />
</RelativeLayout>
import sqlite3
# Create a connection to the SQLite database
conn = sqlite3.connect('customer.db')
cursor = conn.cursor()
cursor.execute('''
''')
conn.commit()
conn.close()
import sqlite3
conn = sqlite3.connect('customer.db')
cursor = conn.cursor()
cursor.execute('''
VALUES (?, ?, ?, ?, ?)
conn.commit()
conn.close()
def retrieve_customer(customer_id):
conn = sqlite3.connect('customer.db')
cursor = conn.cursor()
cursor.execute('''
''', (customer_id,))
customer = cursor.fetchone()
conn.close()
return customer
import sqlite3
conn = sqlite3.connect('customer.db')
cursor = conn.cursor()
cursor.execute('''
VALUES (?, ?, ?, ?, ?)
conn.commit()
conn.close()
def retrieve_customer(customer_id):
conn = sqlite3.connect('customer.db')
cursor = conn.cursor()
cursor.execute('''
''', (customer_id,))
customer = cursor.fetchone()
conn.close()
return customer
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/etNumber1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:hint="Number 1"
android:inputType="numberDecimal" />
<EditText
android:id="@+id/etNumber2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/etNumber1"
android:layout_margin="16dp"
android:hint="Number 2"
android:inputType="numberDecimal" />
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/etNumber2"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_alignParentEnd="true"
android:text="Add" />
<Button
android:id="@+id/btnSubtract"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/etNumber2"
android:layout_toStartOf="@id/btnAdd"
android:text="Subtract" />
<Button
android:id="@+id/btnMultiply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btnAdd"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_alignParentEnd="true"
android:text="Multiply" />
<Button
android:id="@+id/btnDivide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btnAdd"
android:layout_toStartOf="@id/btnMultiply"
android:text="Divide" />
</RelativeLayout>