Uploaded by Aqsa Waqar

mc assigment 2

Assignment #02
Course code
Course title
Mobile Computing
Submitted to
MAM Mehreen Shakoor
Submitted by
Aqsa Waqar
Department of Computer Science,
Mirpur University Of Science And Technology
Q1: What is Android?
Android is a software stack for mobile devices, it was developed by the Open
Handset Alliance, owned by Google it include an operating system, middleware and
key applications.It is Java based operating system that run on Linux kernel. Its
design let users to manipulate the mobile devices intuitively, with finger movements
that mirror common motions, such as pinching, swiping, and tapping. Google also
employs Android software in televisions, cars, and wristwatches_each of which is
fitted with a unique user interface.
The hardware that supports android software is based on the ARM architecture
platform. It is an open-source operating system that means that it’s free and
anyone can use it. The android has got millions of apps available that can help
you manage your life one or another way and it is available to low cost in the
market for that reason android is very popular.
The various components of Android are designed as a stack, with the ‘Applications’
forming the top layer of the stack, while the Linux kernel forms the lowest layer.
Features of android include an accelerated 3D graphics engine, database support
powered by SQLite and integrated web browser.
Android applications are developed in the Java language using the Android
Software Development Kit. Android applications are portable, android itself is not a
language rather than its an environment in which other applications can run.
Android apps can be easily packaged and sold out once developed, either through a
store such as Google Play, Slide ME, Opera Mobile Store, Mobango, F-droid and the
Amazon App store. Android drives hundreds of millions of mobile devices and is
raising exponentially .More than 1 million new Android devices are activated every
day all over the world (190 countries around the world). It is the largest installed base
for any mobile device.
Q2: What are fragments?
Fragments are Android's solution to creating reusable user interfaces.User can use
multiple fragments within one activity. Removing or inserting fragments while an
activity is running is also possible. A fragment has a different lifecycle, but within an
activity it can still included, fragments can be use to arrange the content and
functions of an app's user interface so that it can be quickly navigated.
Fragments not only helps with the endless array of screen sizes ,but Fragments
promotes tremendous reuse of existing layouts and designs to save hour upon hour
of additional design effort. Fragments reduce the complexity of dealing with multiple
screen sizes and the desire to compose layout differently for those different sizes.
For example dealing with a new, much larger screen size, you might think that one
way of tackling this would be to define another layout dimension, such as xxhdpi,
and choose a layout container like RelativeLayout, meticulously laying out your
widgets on this larger canvas for users of larger tablets of an appropriate size. Of
course, tablets come in 7-inch, 10-inch, 13-inch and other sizes, so maybe you’d
need a few of these extra layouts. Next you’ll suddenly realise tablets can be rotated
just like phones, and big-and-tall layouts should really have a short-and-wide
equivalent. All of sudden, you are managing a dozen or more layouts for every
activity within your application. Our example applications have had just one or two
activities up to this point. Imagine an application with a dozen, or twenty, or one
hundred activities.You have to maintain a thousand different layouts just to deal with
Fragments solve the runaway layout issue by introducing an intermediary layer
between activities and the layout containers, and widgets that are rendered within
those containers.
The Fragment Lifecycle
There are areas of commonality between the Fragment lifecycle and that of an
Activity, but it is useful to visualize where things are more complicated. This will help
you appreciate the extra possibilities available when working with Fragments, and
also the extra limitations you will run in to that dictate when and where you can do
things you would assume are possible from your Activity experience.
Fig1.1 shows The Full Fragment Lifecycle
Fig1.1The Full Fragment Lifecycle
Most of the differences when compared to the Activity lifecycle are with the
interaction between a host Activity and its Fragments. There is not necessarily a 1to-1 relationship between lifecycle events at both levels. An Activity experiencing one
event might contain Fragments that have to transition multiple events and stages for
the same trigger.
Q3:Can you explain when to use a fragment compared to an
Whilst using activity we are screen bound for example contacts in an activity in
android we are screen bound of a specific device like of we use same contact in
tablet it will creat space.Fragments solve the runaway layout issue by introducing an
intermediary layer between activities and the layout containers, and widgets that are
rendered within those containers. Fragments reducing the complexity of dealing with
multiple screen sizesFragments not only helps with the endless array of screen sizes
but Fragments promotes tremendous reuse of existing layouts and designs to save
hour upon hour of additional design effort.One have to pause, stop or destroy the old
activity while creating new activity. Using an activity only when one need to switch
the entire screen is a smart technique. Otherwise, we should use fragments in all
other cases. Developers often use fragments when using a navigational method like
if we want to keep a navigation drawer in all our pages. We can inflate a frame layout
with whatever fragment we want and still have access to the navigation drawer. If
used an activity instead of fragment we would have had to keep the drawer in all
activities which makes for redundant code or if the user would benefit from putting
two layouts next to each other
Q4: When replacing a fragment with another one, how do you
know that the user can get back to the last fragment when they
press the back button?
By using Back stack as Back stack in android is used in fragments and its transitions.
for example, in an activity you have one container (frame layout/ view Pager) and you have
a fragment running on it by the result of any action, another fragment is loaded in that
container, you have an option to store first fragment into back stack and you can restore it
when you want. Each fragment transaction should be saved to the back stack to have the
back button get the user to the last fragment.This can be done by calling function
‘addToBackStack()’ before committing that transaction.
Q5: What are advanced features of android and their benefits?
Android has numerous features it allows user so many choice user can customize
them there are thousands of different devices that run Android as its operating
system. It is incredibly easy for users to customize how their phone works and looks
with Android. There are also many quality apps on the Android store. Android’s app
stores tend to be less controlled than Apple’s app store, which encourages Android
app developers to focus on Android app development. Some features of android are
discussed below
1) Connectivity and messaging Android provide facility of non bounding
connectivity and messages as GSM/EDGE, IDEN, CDMA, Bluetooth, WI-FI,
EDGE,3G,NFC, LTE,GPS and messaging as SMS, MMS, C2DM (could to device
messaging), GCM (Google could messaging)
2) Optimized graphics and streaming media support android include an
accelerated 3D graphics engine gives more 3D and real graphics.
3) Near Field Communication (NFC) Most Android devices support NFC, which
allows electronic devices to easily interact across short distances. The main aim
here is to create a payment option that is simpler than carrying credit cards or cash,
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).
4) Alternate Keyboards Android supports multiple keyboards and makes them easy
to install; the SwiftKey, Skype, and 8pen apps all offer ways to quickly change up
your keyboard style. Other mobile operating systems either don’t permit extra
keyboards at all, or the process to install and use them are tedious and timeconsuming.
5) Infrared Transmission The Android operating system supports a built-in infrared
transmitter, allowing you to use your phone or tablet as a remote control.
6) No-Touch Control Using Android apps such as Wave Control, users can control
their phones touch-free, using only gestures. Have messy hands but need to turn off
your screen or change a song? This could prove especially useful if you’re driving,
so you can keep both eyes on the road.
7) Automation The Tasker app lets you not only control app permissions but also
automate them. Do you only want your location services to be active during the day?
Want to create a customized way to start your music—for example, with a voice
command and at a certain volume? Tasker can help.
8) Wireless App Downloads Accessing app stores on any mobile device can be
frustrating, but iOS makes it a little more difficult—download an app on your
computer, and it won’t sync to your mobile device until you plug in and access
iTunes. Using the Android Market or third-party options like AppBrain, meanwhile, let
you download apps on your PC and then automatically sync them your Droid, no
plugging required.
9) Storage and Battery Swap Android phones also have unique hardware
capabilities. Google’s OS makes it possible to remove and upgrade your battery or to
replace one that no longer holds a charge. In addition, Android phones come with D
card slots for expandable storage.
10) Headset layout While it’s possible to hack certain phones to customize the
home screen, Android comes with this capability from the get-go. Download a thirdparty launcher like Nova, Apex or Slide and you can add gestures, new shortcuts, or
even performance enhancements for older-model devices.
11) Widgets Apps are versatile, but sometimes you want information at a glance
instead of having to open an app and wait for it to load. Android widgets let you
display just about any feature you choose, right on the home screen—including
weather apps, music widgets, or productivity tools that helpfully remind you of
upcoming meetings or approaching deadlines.
12) Custom ROMs This is a big one. Because the Android operating system is open
source, developers can tweak the current OS and build their own versions, which
users can download and install in place of the stock OS. Some are filled with
features, while others change the look and feel of a device. Chances are if there’s a
feature you want, someone has already built a custom ROM for it.