Professional Documents
Culture Documents
PART-A(2 MARKS )
1) Mention some mobile computing devices?
i)laptop computers
ii) tablets
iii) smartphones
iv)E-readers
v) handheld gaming devices
2)what are the different types of networks?
Mobile computing uses different types of networks
i) wired networks
ii) wireless networks
iii) ad-hoc networks
3)what is meant by ad-hoc networks?
it is a wireless Ad-hoc network.it is a decentralized type of the wireless
network. The network is adhoc because it does not rely on a pre-existing infrastructure
such as routers in wired networks or access points in wireless networks.
4)what are the various type of wireless communication technologies used in mobiles?
There are various type of wireless communication technologies used in mobiles.
1) IrDa
2) Bluetooth
3) Wi-Fi
4) NFC
5)what do you mean by Wi-Fi?
➢ WI-Fi means wireless Fidelity
➢ Wi-FI is a technology that uses radio waves to provide network connectivity
➢ Wireless networking is known as WiFi or 802.11 networking as it covers the
IEEE 802.11 tchnologies
6)what do you mean by Wi-MAX?
WI-MAX means worldwide interoperability for microwave access. It is a type of
wireless technology that provides wireless internet service over long distance that standard
WiFi. It access the internet upto over 30 miles.
7) what do you mean by Bluetooth technology?
➢ Bluetooth is a wireless LAN technology that connects devices in a small area
➢ Compared to infrared, Bluetooth devices can work together
➢ Current devices can transfer in the range of 30 feet
➢ Blutooth uses radio frequency and hence transmission Ispossible through walls or
other objects and hence it is widely used in computers,PDA,handsets, mobile
handsets, etc
➢ These devices can communicate with each other irrespective of the manufacturer.
` PART-B (3 MARKS )
1) Briefly explain wired networks
A wired network uses physical cables, to transfer data between different devices and
computer systems . most wired networks use Ethernet cables to transfer data between
connected PCs. In a small wired networks , a single router may be used to connect al the
computers, laeger networks often involve multiple router or switches that connects to a cables
modems, telephoneline, or other type of internet connection that provides internet access to
all device connected to the network i.e. Fixed telephone networks over copper and fiber-optic
or broadband networks over DSL or cable will be part of wired network.
2) Briefly explain antennas.
an antenna is a specialized transducer that converts radio-frequency field into alternating
current or vice versa. There are two types:
1) Receiving antenna
2) Transmitting antenna
(i) Receiving antenna
It intercepts RF energy and delivers AC to electronic equipment.
(ii) Transmitting antenna
➢ It is fed with AC from electronic equipment and generates an RF field.
➢ In computer and internet wireless applications , the most common type of
antenna is the antenna is the dish antenna used for satellite communications.
➢ The disk consists of a parabolodial or spherical reflector with an active
element at its focus. When used for receiving the disk collects RF from a distant
source and focuses it at the active element. When used for transmitting the active
element radiates RF that Is collimated by the refdlctor fo delivery in a specific
direction. Active element can be a dipole antenna or horn antenna. this active
elements constitutes the main RF radiating and receiving element in dish antenna.
3) Explain any three applications of WLAN
1) In home
in homes, WLAN can be used for including networking of different home devices like
phones, computers and home appliances.
2)workgroup environment
WLAN is very useful where small workgroups or teams need to work
together. The team may be
-a survey team on top of a hill
- resce group after a natural disaster
-an accident site
-civil cinstruction sites.
3) public places
WLAN is useful in airports, railway stations or places where many people assemble
and need to access information.
4) Give any three applications of Bluetooth.
i) Wireless headsets
ii) Interface between device and entertainment systems.
iii) Replacement for some Wi-Fi networks.
iv) Wireless bridging in corporate or industrial networks.
v) Video game console controllers.
PART-C(10 MARKS )
1. Explain about important terminologies of mobile computing.
Cell
It is the smallest Geographical Area for cellular mobile communication radio coverage.
The shape of the cell is Hexagon.
Each cell has a Base Station.
Base Station
Base Station provides function between mobile unit and message switching center. Base
station consists of antenna, control unit and a transceiver. It is located in each cell.
Mobile Unit
It is a hand held device that communicates with the base station
A mobile unit is uniquely identified by International Mobile Equipment Identity (IMEI)
An individual subscriber can be identified by International Mobile Subscriber Identity.
(IMSI)
Cell Splitting
In high cellular traffic regions, the larger cells are sub-divided into smaller cells for complete
radio coverage.
Hand-off
When a mobile unit moves from one cell to another cell, the call in progress will be handed
over from one base station to another without disturbing the call in progress.
Control Channel
It is used for necessary exchange of information which is related to settings regarding
establishment of cell Base Station and the Mobile Unit.
Cell Sectoring
A single cell can be divided into multiple sectors, where the directional antenna should focus
on each sector.
Traffic Channel
It is used for carrying data or voice connections between different users.
Fading
When one signal path loses its strength, it is called Fading.
Forward Channel
The transmission of information from base station to mobile unit is called Forward Channel.
Reverse Channel
The transmission of information from mobile unit to base station is called Reverse Channel.
Transceiver
It is a device used for both transmitted and receiving radio signals.
Subscriber
Those who pays some amount as a subscription charges for using Mobile Communication
system
Mobile Station
It is present in the hand held personal unit.
It is mainly intended its service while in movement at any location.
Simplex System
The communication system which allows only one way communication
Example : Walkie Talkie
Roamer
If mobile station operated its own services from an area other than the subscribed area.
2. What are the different type of networks, mobile computing uses? Explain them.
Mobile computing uses different type of network
(i) Wired networks
(ii) Wireless networks
(iii) Ad-hoc networks
(i) Wired networks
A wired network uses physical cables, to transfer data between
different devices and computer systems . most wired networks use Ethernet
cables to transfer data between connected PCs. In a small wired networks , a
single router may be used to connect al the computers, laeger networks often
involve multiple router or switches that connects to a cables modems,
telephoneline, or other type of internet connection that provides internet access
to all device connected to the network i.e. Fixed telephone networks over
copper and fiber-optic or broadband networks over DSL or cable will be part
of wired network.
(ii) Wireless networks
Wireless network refers to the use of infrared or radio frequency signal
to share information and resources between devices.
Example for wireless devices
i) Mobile terminak
ii) Pocket size PCs
iii) Hand held PCs
iv) Laptops
v) Cellular phones
vi) PDAs
vii) Wireless sensors
viii) Satellite receivers, etc
Example for wireless networks
i) PCS(personal cellular system)
ii) AMPS(advanced mobile phone system)
iii) GSM
iv) CDMA
v) DOCOMO
vi) GPRS,etc.
iv) Ad-hoc networks
it is a wireless Ad-hoc network.it is a decentralized type of the wireless
network. The network is adhoc because it does not rely on a pre-existing
infrastructure such as routers in wired networks or access points in wireless
networks.
In latin, adhoc means for this purpose only. In these networks some of
the devices are part of the networks only for the duration of the
communication session.
In adhoc networks, new devices can be quickly added using Bluetooth
or wireless LAN . these networks don’t require subscription service, or carrier
networks.adhoc network topology is dynamic ie.., nodes enter and leave the
network continuously.
3. With neat diagram, explain the architecture of mobile computing.
the mobile computing architecture uses a three tier architecture.
3-tier architecture
This three tier architecture uses three layer.they are
(i) User interface or presentation tier(tier1)
(ii) Process management or application tier(tier2)
(iii) Database management or data tier(tier 3)
3-tier setup
Enterprises
java ORACLE
Disadvantage
• Works only on line-of-sight mode • Limited number of free frequency
• Short range bands.
• Blocked by common materials : • Shielding is difficult.
people, walls,etc.., • Interference with other electrical
• Low bandwidth devices
• Speed is comparatively slow. • Greater power consumption
Example • Limited spectrum of frequency
• Remote control
• Mobile phones
• FM channels
• Walkie talkies
5. Explain mobile computing functions in details
1. user mobility
The User should able to use the same service from one place to another. The
service may be remote or home network.
Example: user moves from nagercoil to delhi. He uses internet to access a particular
application the same way the user uses in the home office
2. bearer mobility
It is used to same service if even if the mobile station, moves one bearer to
another bearer.
3. host mobility
In such case IP should be given care if it is on move.
4. service mobility
User change from one service to another service should remain enabled
5. network mobility
User should be able to move from one network to another network and use the
same service.
6. device mobility
User should be able to move from one device to another and use the same
service.
(ii) WI-FI
*Wifi means wireless fidelity
*Wifi is a technology that uses radio waves to provide network connectivity
*Wireless networking is known as wifi or 802.11 networking as it covers the IEEE
802.11 technologies.
*It range upto 50 mtrs
*It is mostly used at the speed of 7mbps and it speed is 10 times higher than Bluetooth
technology
*Which are used in wireless enabled laptops, desktop, mobiles.
*It is used in college, office, schools, conference call.
UNIT-2
INTRODUCTION TO GSM,SMS,GPRS,MOBILE OS
Part-A ( 2 MARKS)
1.What is GSM?
GSM is an abbreviation of global system for mobile communications.It is the
most widely used cellular technology in use in the world today. GSM system was
designed as a second generation (2G) cellular phone technology.
GSM offers the following services:
• Voice services
• Data services
• Short message services (SMS)
2. Define CDMA
Code Division Multiple Access (CDMA) is a digital cellular technology used for
mobile communication. It is a channel access method used by various radio
communication technologies. CDMA is an example of multiple access. Here several
transmitter can send information simultaneously over a signal communication channel.
This allows several users to share a band of frequency. To permit this without
interference between the users, CDMA uses spread spectrum technology and special
coding scheme. i.e., each transmitter is assigned a code.
3. Define SMS
SMS (Short Message Services) is commonly referred to as text messaging. It is a
service for sending short messages of upto 160 characters to mobile devices including
cellular phones, smartphones and PADs.
SMS is similar to paging. SMS message does not required the mobile phone to be
active and within range. It will be help for a number of days until the phone is active and
within range. SMS messages are transmitted within the same cell or to any one with
roaming.
Part-B ( 3 MARKS)
➢ Some examples
➢ News/Stock Quotes Service
➢ Session-based Chat Application
➢ Email through SMS
➢ Health Care Services
➢ Micro-payment Services
➢ Internet access
➢ Email
➢ Web browsing
➢ Mobile commerce
➢ Banking
➢ Sports score
➢ Flight information
➢ Prayer reminders
➢ Jokes
➢ Traffic information,etc.
➢ Weather
➢ News headlines
➢ Lottery results
➢ Horoscopes
Chat
It is used as means to communicate and discuss matters of common interest.
GPRS will offer ubiquitous chat by integrating Internet Chat and Wireless Chat using
SMS and WAP.
2. Multimedia Services
4. Vehicle Positioning
➢ This application integrates GPS that tell people where they are.
➢ Anyone with a GPS receiver can receive their satellite position and thereby find
out where they are.
➢ Vehicle positioning applications .
PART – C ( 10 MARKS )
GSM Architecture The GSM network architecture consists of three major subsystems.
They are;
➢ Mobile Station
➢ Base Station Subsystem
➢ Network Subsystem
A mobile station communicates across the air interface with a base station
transceiver in the same cell in which the mobile subscriber unit is located. The MS has
two elements. The Mobile Equipment (ME) refers to the physical device, which
comprises of transceiver, digital signal processors, and the antenna. The second element
of the MS is the GSM is the Subscriber Identity Module (SIM). The SIM card is unique to
the GSM system. It has a memory of 32 KB.
A base station subsystem consists of a base station controller and one or more
base transceiver station. Each Base Transceiver Station defines a single cell. A cell can
have a radius of between 100m to 35km, depending on the environment. A Base Station
Controller may be connected with a BTS. It may control multiple BTS units and hence
multiple cells. There are two main architectural elements in the BSS – the Base
Transceiver Subsystem (BTS) and the Base Station Controller (BSC). The interface that
connects a BTS to a BSC is called the A-bus interface. The interface between the BSC
and the MSC is called the A interface, which is standardized within GSM.
The NSS is responsible for the network operation. The NSS has one hardware,
Mobile switching center and four software database elements. It provides the link
between the cellular network and the Public switched telecommunicates Networks (PSTN
or ISDN or Data Networks).
The NSS controls handoffs between cells in different BSSs, authenticates user and
validates their accounts, and includes functions for enabling worldwide roaming of
mobile subscribers. In particular the switching subsystem consists of:
It performs the switching function of the system by controlling calls to and from
other telephone and data systems. It includes functions such as network interfacing and
common channel signaling.
The HLR is database software that handles the management of the mobile
subscriber account. The HLR is the reference database that permanently stores data
related to subscribers, including subscriber’s service profile, location information, and
activity status.
Visitor location Register (VLR)
The VLR is temporary database software similar to the HLR identifying the
mobile subscribers visiting inside the coverage area of an MSC. The VLR assigns a
Temporary mobile subscriber Identity (TMSI) that is used to avoid using IMSI on the air.
Authentications center (Auc)
The AuC database holds different algorithms that are used for authentication and
encryptions of the mobile subscribers that verify the mobile user’s identity and ensure the
confidentiality of each call. The AuC holds the authentication and encryption keys for all
the subscribers in both the home and visitor location register.
The EIR is another database that keeps the information about the identity of
mobile equipment such the International mobile Equipment Identity (IMEI) that reveals
the details about the manufacturer, country of production, and device type. This
information is used to prevent calls from being misused, to prevent unauthorized or
defective MSs, to report stolen mobile phones.
2. Explain about SMS Architecture.
(i) SMMT
➢ SMMT is an incoming short message from the network side and is
terminated in MS.
➢ For incoming message, the path is from Sc to the MS via HLR and the
GMSC function of the home MSC.
➢ Above diagram the message flow is indicated by the numbers in the order
as
6 7 8 9 10 11
➢ Here GMSC is a special kind of MSC. it is used to route calls outside the
mobile network.
➢ Also the term PLMN means a public land mobile network. It is any
wireless communication system intended for use by subscribers in vehicles
or on foot.
(ii) SMMO
➢ SMMO is an outgoing message original in the user device
➢ Then forwarded to the network for delivery.
➢ For out going message, the path is from MS to Sc via the VLR and the
IWMSC function of the serving MSC.
➢ The path is represented as MS1 MSC VLR MSC
SMS IWMSC SC.
➢ Above diagram the message flow is indicated by the numbers in the order
1 2 3 4 5
➢ Here IWMSC stands for interworking mobile switching centre.
➢ The serving network provides the user with access to the services of their
home environment.
➢ Home network is a type of network that facilitates communication among
devices within the close vicinity of a home.
GPRS technology uses packet switching in line with the internet. The makes more
efficient use of the available capacity and it allows greater commonality with internet
techniques. Here the following topics are discussed
a) Capacity and other end-user aspects
• The data transfer of GPRS is 14.4 KBps to 171.2 KBps.
• This allows comfortable internet access
• It allows e-mail, web browsing as well as large volumes of data.
• For GPRS, no dial-up modem connection is necessary.
• It is like SMS i.e. always-on services.
• Immediacy is one of the advantages of GPRS compared to circuit switched
data.
b) Quality of services(QoS)
GPRS allows definition of QoS profiles using the parameters of services
precedence, reliability, delay and throughput.
i. Service precedence
It is the priority of a service in relation to another service. There
exists three levels of priority: high, normal and low.
ii. Reliability
This indicates the transmission characteristics required by an
application.
iii. Delay
It defines maximum values for the mean delay. The delay is
defined as the end-to-end transfer time between two
communicating mobile stations or between a mobile station and the
signalling interface to an external packet data network.
iv. Throughput
It specifies maximum/peak bit rate and the mean bit rate.
d) Goals of GPRS
• Open architecture
• Consistent IP services
• Same infrastructure for different air interfaces.
• Integrated telephony and internet infrastructure.
• Service innovation independent of infrastructure.
UNIT III
INTRODUCTION TO ANDROID
PART-A(2 MARKS)
1) What is an android?
Android is an open source and Linux based operating system for mobile device
such as smart phones and tablet computers. Android was developed by the open Handset
Alliance, led by Google and other companies
5) What is ADV?
An android virtual device is an emulator configuration that allows to develop the
test application by simulating the real device capabilities, we can configure the AVD
by specifying the hardware and the software option.
6) What is intent?
An android intent is a abstract description of an operation to be performed, intent
is an intent object. It is passive data structure which contains abstract description of an
operation to be performed.
8) Define view
• The basic building block of user interface is a view object.
• View is a simple rectangular box which is a responsible to the user action.
• View referred to the Android.view.View class, which is the base class of all UI
classes
• Android contains the following commonly used view subclasses.
-Textview
-editText
-ImageView
-ProgressBar
-Button
-ImagesButton
-CheckBox
-DatePicker
.
9) Define ViewGroups
• Viewgroups is a subclass of the view class.
• It provides the invisible container that hold other view or viewgroup and define their
layout properties
View
BUTTON
A notification is a message we can display to the user outside of our applications normally
UI. When we tell the system to issue a notification, it first appears as icon in the notification
area.
PART-B (3 MARKS)
1) Briefly explain android SDK
Creating an AVD
1) Go to tools→AVD management
2) Your virtual Devices windows appear. Click Create virtual device at the left corner.
3) Many virtual devices appear. Choose phone category. select the device you want to use.
4) System image windows appear. Select the needed one and click next.
5) Verify the configuration window that appears and click finish.
6) Now nexus 5x devices emulator is included in the virtual device list.
7) Close the AVD Manager to go back to android studios main view. Now we have
configuration everything.
3) Draw the flowchart of the android fragmentation life cycle
On Attach() On detach()
On create() On destroy()
On activity Created()
On start() On stop()
Single frame fragments, are user in hand head devices like mobiles, here we can
show only one view.
Action bar is a menu bar that runs across the top of the activity screen.
Android action bar can contain menu items which become visible when the lcicks the
‘menu’ button.
Architecture of android
The figure shows the four major layers of android operating systems. They are
Block Explanation
Activity This block is used to manage the computer activity life
Management cycle of application.
Content This block is used to manage the data sharing between two
Provider applications.
Telephony
Management This block is used to manage all voice calls.
Location This management is used to manage the location object
Management using GPS or cell tower.
Resource This management ids use to manage the different types of
Management resources used in android apps.
Architecture of android.
APPLICATIONS
APPLICATION FORMWORK
Activity Window Content View
Manager Manager Provider System
Resource
Package Telephony Location Notification
Management
Management Management Management management
(a) Libraries
• This is present on the top of the Linux.
• It provides different libraries useful for the well functioning of android operating
system.
• Libraries are java libraries built specific for android operating system.
Libraries Explanations
SQLite It is used to access data published by content providers and includes SQLite
database management system classes.
OpenGL It provides java interface to the Open GL/ES 3D graphic rendering API
Media It provides different media codes which allow the recording and playback of
framework different media formats.
Webkit It is the browser engine used to display internet content or HTML content.
(b) Android Runtime
• It is placed in second layer form bottom.
• it provides most important part of android called Dalvik Virtual Machine
• Dalvik Virtual Machine is similar to JVM but only different is that it is designed and
optimized for android.
• Dalvik Virtual Machine uses code functions of Linux such as memory management
and multithreading and enable each android.
Android Runtime provides most important of android called Dalvik Virtual Machine.
Dalvik Virtual Machine is the software responsible for running apps on android devices.
Java compiler
DVM
Here java file is given to java compiler to generate .class file. All .class
file are given to dex file is given to dvm to generate final .machine code is given to CPU for
execution.
Understanding activity
An activity represent a single screen with user interface just like windows or frame of
java ie. Activity per form action on the screen
• If an application has more than one activity, then one of them should be marked as the
mail activities that is presented in the application is launched
• Android activity is the sub class of Context Theme Wrapper class.
• In c or c++ or java, our our program starts from the main() function. Similarly android
system initiates its program within an activity. Program starts with a class on on create() call
back method. Callback is nothing but an event.
• There is a sequence of call back method that starts up an activity.
3 onResume() Called when the users starts interactions with the application
4 onPause() Called when the current activity is been in paused and the
SetContentView(R.layout.activity_main):
• Every activities we define for our application must be declare in
androidsMainfest.xml and the main activities for our app must be declare in the
manifest with an <inter_filter> that includes the MAIN action and LAUNCHER
category as folowes:
<inter_filter>
<inter_filter>
</activity>
If the MAiN action or LAUNCHER category is not declare for one of our activity
,then our ap icon will not aper in the Home screen list of apps.
Here
Android:name – attribute which specifies fully qualified class name of the activity
subclass.
Android.intent.action.MAIN- indicates that this activity serves as the entry point
for the application
Fragments:
A Fragment is a piece of an application's user interface or behavior that can be placed in
an Activity which enable more modular activity design. It will not be wrong if we say, a
fragment is a kind of sub-activity. Following are the important points about fragment:
➢ A fragment has its own layout and its own behavior with its own lifecycle callbacks.
➢ You can add or remove fragments in an activity while the activity is running.
➢ You can combine multiple fragments in a single activity to build a multipane UI.
➢ Fragment life cycle is closely related to the lifecycle of its host activity which means
when the activity is paused, all the fragments available in the activity will also be
stopped.
Fragment Life Cycle Android fragments have their own life cycle very similar to
an android activity. This section briefs different stages of its life cycle.
Users interact with your UI at two levels: the activity level and the views level. At the
activity level, the Activity class exposes methods that you can override. Some common methods
that you can override in your activities include the following: .
There are two levels of android user interface with which users interact and they are.
i) Activity level
ii) View level
i) Activity level
➢ onKeyDown — Called when a key was pressed and not handled by any of
the views contained within the activity
➢ onKeyUp — Called when a key was released and not handled by any of
the views contained
➢ onMenuItemSelected — Called when a panel’s menu item has been
selected by the user
➢ onMenuOpened — Called when a panel’s menu is opened by the user
overriding methods defined in an Activity .
When any user interacts with a view, the corresponding view fires event. when a user
touches a button or an image button or any such view we have to service the related service so
that appropriate action can be performed.
UNIT IV
VIEWs
PART-A (2 MARKS )
1) What is view?
View is a class which represent the basic building block for user interface
components. A view occupies a rectangular area on the screen and is responsible for
drawing and event handling. View is the base class for widgets which are used to create
interactive UI component (button, ext fields, etc…,)
Methods
1) Get day of month()-gets the selected day of moth.
2) Get month()-gets the selected month.
3) Get year()-gets the selected year
4) Update date(int year, int month, int day of month)-updates the current date
5) Get calendar view()-returns calendar view
6) Get first day of week()-return first day of the week.
5) Explain List View
Android list view is a view which groups several items and display them in vertical scrollable
list. The list item are automatically inserted to the list using an adapter that pulls content from a
source such as an array of database.
An adapter actually bridge UI components and the data source that fill data into UI
component. Adapter holds the data and sends the data to adapter view. The view can take the
data from adapter view and shows the data on different views. The List View and Grid View are
subclasses of adapter view.
List view attributes
Attriburte description
Android:id This is the ID which uniquely identifies the
Android:divider view.
This is drawable or color to draw between
listitems.
Android:divideHeight This specifies height of the divide.
Android:footerDividerswEnabled Default value is true. When false, the list view
will not draw the divider after each footer
view.
Android:headerdividersenabled Default value is true. When false,the listview
will not draw the divider after each header
view.
4) Run the application. Now android emulator appears which shows current time in
analogclock as well as digitalclock
Example:
1. create a new project
2. open res-> layout->activity_main.xml file.
3. Then drag text view component and keep it inside the relative layout of the design
view.
4. TextView
android:id="@+id/text_view_id"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/hello" />
5. Run the project.
Edit text
Edit text is an overlay over text view that configures itself to be editable. It is
the predefined subclass of text view that includes rich editing capabilities
Attributes
Button
A button is a push-button which can be pressed, or clicked by the user to
perform an action. A button consists of text or an icon that communicative what
action occurs when the user touches it.
Attributes
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
Button button;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
addListenerOnButton();
@Override
Intent browserIntent =
startActivity(browserIntent); }
});
Image view
Android image view is used to display an image. To add an image to resources,
put your image into the folder “res/draw able”.
Attributes
Attribute Description
Android:croptopadding If true, the be image will be cropped to fit with its
padding
Android:MAxheight Supplies a maximum height for this view.
Android:maxwidth Supplies a maximum width for this view.
Android:scaletype Controls how the image should be resizedor moved
to match the size of this imageview
Android:src Set the drawabvle as the content of this imageview.
Methods
1) set image bitmap(bitmap bm) - sets a bitmap as the content of the image view.
2) set image Draw able (draw able draw able) - sets a draw able as the content of this image
view.
3) set image icon(icon icon) – sets the content of this image view to the specified icon.
4) setimageresource (int reside) – sets a draw able as the content of this image view
5) set image URI – set the content of this image view to the specified URI.
Attributes
1) Id
2) Padding
3) Background
4) Animation duration
5) Spacing
6) Unselectesalpa, etc..,
iii) imageSwitcher
sometimes we don’t want an image to appear abruptly on the screen. But we want
to apply some kind of animation to the image when it transitions from one image to
another. This is supported by android in the form of imageswitcher. An imageswitcher
allows us to add some transitions on the images through the way they appear on screen.
To use iamgeswitcher, do the following
1) define its XML component first, by dragging this control into the design view and
changing the attributes according to our need.
2) Create an instance of imageswitcher in java file and get a reference of this XML
component.
Imageswitcher=(imageswitcher)findViewBYid(R.id.imageswitcher
1);
3) Implement the viewfactory interface and implement the method that return an
iamgeview
Imageswitcher.setImageResource(R.drawable.ic_launcher);
Iamgeswitcher.setfactory(new viewFactory() {
Return myview;
}
4) Now add animation to the iamgeswitcher. We need to define an object of
animation class through animationUtilites class by calling a static method
loadanimation.
Imageswitcher.setInanimation(in);
Imageswitcher.setOutAnimation(out);
Here the method setInAnimation sets the animation of the appearance of the object on the screen
where setOutAnimation does the opposite. The method loadanimation() creat an animation
object.
iv)gridview
gridview layout is one of the most useful layouts in android. Gridview is mainly useful
when to show data in gridlayout like displaying image or icons. This can be used to build
applications like image viewers audio or video players in order to show elements in grid manner.
Grid items are not necessarily predeterminedbut they are automatically insered to the
layout using a ListAdapter. An adapter actually bridge between UI components and the data
source that fills data into UI component.
Grid view is a subclass of adapter view and it can be populated by binding it to an
adapter. This adapter retrives data from an external source and creates a view.
Sendintent.setType(“vnd.android-dir/mms-sms”);
Sendintent.putExtra(“address”,”phoneno”);
StartActivity(sendintent);
<uses-permission android:name=”amdroid.permission.SEND_SMS”/>
ii) using SMS manager API
• for sending SMS message, SMS Manager class can be used.
• The code for this is
SMSManager
SMS=SMSManager.getDefault();
SMS.sendTextmessage(“phone
no”,null,”sms message”,null,null);
For receiving SMS messages the application can be developed by using the
following classes and methods.
i) <uses-permission
android:name=”android.permission.RECEIVE_SMS”/>
• We can continue to listen for coming SMS messages even if the application is not
running as long as the application is installed on the device.
• In the Androidmanifest.xml file,we have to include the folllowing.
</intent-filter>
</receiver>
UNIT V
Location based services are services offered through a mobile phone and take into
account the devices geographical location. one of the key ingredients in a LBS app is maps.
this presents a visual representation of our location.
In location based service if we know the address of a location but want to know its
latitude and longitude, the process used for this is known as geo coding. For geo coding,
the class used is Geocoder. And the methods used are
Get Latitude()
Get Longitude()
In location based service if we know the latitude and longitude of a location, we can
find out its address. the process used for this purpose is called as reverse geocoding.
Google maps in android supports this via the Geocoder class.
A content provider is a component that supplies data from one application to others on
request. a content provider can use different ways to store its data and the data can be
stored in a database, in files or even over a network.
(i) started
(ii) bound
7. What are the two methods used for sending data using HTTP protocol?
Android app uses HTTP protocol to send data. The methods used for sending data are
Apps on your phone like Whatsapp, Facebook, Gmail uses web services.
PART B (3 MARKS)
Mapview=(mapview)findviewbyid(R.id.mapView);
Mapview.setBuiltinzoomcontrolIs (true);
When running the application with the above code, a map appears. When we click and
drag the map, built-in zoom controls appear at the bottom of the map.
We can click the minus(-) icon to zoom out of the map and the plus(+) icon to zoom into the
map.
The mapController class contains the Zoomin() and zoomOut() methods to enable
users to zoom in or out of the map respectively.
3) Execute it.
InputStream is = entity.getcontent();
While((line= reader.readLine())!=null)
Sb.append(line + “\n”);
Is.close();
The following tasks are needed to access data from the web service.
(I) Using HTTP, client is connected to the server.
(II) If HTTP POST method is used for sending requests to the server, the HttpPost
class is used to specify the URL of the server. The data are accessed and appended to
the URL.
(III) T he Http Client class is used to connect to the server.
(IV) The Http Response class is used to get the connection status from the server. If
the status code is 200,it means that the connection is successfully established with the
server.
(V) On establishing connection with the server, the Buffer Reader and Input Stream
Reader classes are used to fetch the information returned by the web service. The
information returned by the service is in JSON format.
(VI) From the received JSON format the data are accessed and displayed.
(VII) Also to access the web service uploaded on a server, we need to add internet
permission in the AndroidManifest.xml file as
<uses-permission android:name = “android.permission.INTERNET”/>
Adding markers to a map indicates places of interest.it enables users to easily locate
the places they are looking for. the procedure to add a marker to google maps is given below.
2).to add marker to the map,we first need to define a class that extends the overlay
class.
Com.google.android.maps.Overlay
@ override
//--
An overly represents an individual item that we can draw on the map.we can add as many
overlays as we want.
3).in the mapoverlay class,override the draw() method so that we can draw the
pushpin image on the map.
Mapview.getProjection().toPixels(P,screenpts);
5).because we want the pointed tip of the pushpin to indicate the position of the
location,we need to deduct the height of the image(for eg.say50pixels) from the y coordinate
of the point(see the figure below)and draw the image at that location.
Bitmap bmp=BitmapFactory.decodeResource(getResources(),R.drawable.pushpin);
Canvas.draw.Bitmap(bmp.ScreenPts.x,ScreenPts.y-50,null);
6).to add the marker,create an instance of the MapOverlay class and add it to the
list of overlays available on the MapView object.
List<Overlay>listofOverlays=mapView.getoverlays();
Listof Overlays.clear();
ListofOverlays.add(mapOverlay);
We can save files directly on the device’s internal storage.by default,files saved to
the internal storage are private to our application and other applications cannot access
them.when the user uninstalls the application,these files are removed.
1).call OpenFileOutput() with the name of the file and the operating mode.this returns a
FileoutputStream.
Example:
FILENAME=”welcome_file”;
FileOutputStream fos=”openFileOutput(FILENNAME,Context.MODE_PRIVATE);
Fos.write(String.getBytes());
Fos.close();
Here MODE_PRIVATE will create the file and make it private to our
application.other modes available are MODE_APPEND,MODE_WORLD_READABLE and
MODE_WORLD_WRITABLE.
1).call openFileinput() and pass it the name of the file to rea.this returns a FileinputStream.
External storage can become unavailable if the user mounts the external storage
on a computer or removes the media,and there’s no security enforced upon files we save to
the external storage.all applications can read and write files placed on the external storage
and the user can remove them.
For example,
<manifest….>
<uses-permission
android:name=”android.permission.WRITE_EXTERNAL_STORAGE”/>
</manifest>
The steps for storing public file to the external file name.
Storage are
for reading files from the external storage,our app must acquire
READ_EXTERNLA_STORAGE system permission.for example,
<manifest….>
<uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE”/>
</manifest>
SQLite
Creating database
In order to create a database, we just need to call this method openOrCreateDatabase with our
database name and mode as a parameter.it returns an instance of SQLite database which we
have to receive in our own objects.
Syntax
SQLiteDatabase mydatabase=openOrCreateDatabase
(‘’your databasename”,MODE_PRIVATE,null);
Using databases
a) Database insertion
We can create table or insert data into table using execSQL method defined in
SQLiteDtatabase class.
Mydatabase.execSQL(“CREATE TABLE IF NOT EXISTS polytechnic(username
VARCHAR,password VARCHAR);”);
Syntax
execSQL(string sql,object[]bindArgs)
c) Database fetching
We can retrieve anything from database using an object of the Cursor class.
We will call a method of this class called raw query and it will return a with the
cursor pointing to the table. we can move the cursor forward and retrieve the data.
Ex:
resultSet.moveToFirst();