S6-Mobile Application Development - Android Full Note
S6-Mobile Application Development - Android Full Note
Module 1
2. Android version 1.5: Cupcake :- the Android updated to 1.5 with the codename of
the dessert item (Cupcake).
-It supports third-party virtual keyboard, Video recording and playback in MPEG-4
and mp3 format, Copy and paste feature, auto-rotation option, ability to upload a
video to YouTube, check phone usage history.
3. Android version 1.6: Donut :- Android 1.6 was released with the name Donut.
-It contains numerous new features such as voice and text entry search, bookmark
history, contacts, faster camera access, user can select multiple photos for deletion,
support text-to-speech engine.
4. Android version 2.0 to 2.1: Eclair :- Android 2.0 was released, whose codename was
Eclair.
-It contains the several new features as change wallpaper ,new camera
features,digital zoom, colour effects ,Bluetooth 2.1,delete the oldest message
automatically when the defined limit is reached, bug fixes.
5. Android version 2.2 Froyo :- It contains several features as speed, memory,
performance optimization.
-voice dialing, contact sharing over Bluetooth,security updates,
6. Android version 2.3 Gingerbread :- the Android 2.3 (Gingerbread) was released.
-It includes the following changes: support for extra-large screen size and
resolutions, enhanced copy/paste functionality, select a word by press-holding, new
Download Manager.
7. Android version 3.0 Honeycomb :- Android 3.0 (Honeycomb) was launched for the
first Android based tablet.
-redesign the keyboard making fast typing, quick access to camera, connectivity for
USB accessories, support for joysticks and gamepads, Google Books, fixed data
connectivity issues when coming out of Airplane mode.
-it improve multitasking.
8. Android version 4.0 Ice Cream Sandwich :- Android 4.0.1 (Ice Cream Sandwich) was
launched.
-t introduces the numerous new features: screenshot capture, improved copy and
paste functionality, build-in photo editor, fixed minor bugs, spell-checking, better
camera performance.
-it include 1080p recording.
9. Android version 4.1 Jelly Bean :- It updates to following features: smoother user
interface, lock screen improvement, new clock application, volume for incoming call,
4K resolution support,
10. Android version 4.4 KitKat :- Google announced Android 4.4 (KitKat).
- Initially, its code name was "Key Lime Pie".
-The minimum required amount of RAM should available to Android is 340 MB.
-The other devices with less than 512 MB of RAM must report themselves as "low
RAM" devices.
- It includes several new features ; wireless printing capability, built-in screen
recording feature,
11. Android version 5.0 Lollipop :- Lollipop provides several features like support for 64-
bit CPUs, battery life improvement, multiple user accounts,, join Wi-Fi networks,
support for multiple SIM cards, device protection,
12. Android version 6.0 Marshmallow :-Android lunches "Marshmallow" for all android
devices.
-It contains the various new features as , introduce the Doze mode to save battery
life, fingerprint reader support,, USB-C support, emoji support.
13. Android version 7.0 Nougat :- Its initial codename was "Android N".
- file-based encryption, zoom in the screen, new Data Saver mode, 75 percent faster
app installation, circular app icons support, send GIFs directly from the default
keyboard, battery usage alerts.
14. Android version 8.0 Oreo:- notification dots, 2 times faster boot time, Google Play
Protect, Android Oreo Go Edition, dark themes.
15. Android version 9.0: Pie :- The clock has moved to the left of the notification bar, the
"screenshot" button has been added, battery percentage always shown on display.
16. Android version 10 :- is the tenth extensive version of the Android operating system.
-Android 10 has developed under the codename "Android Q".
-It contains features like new permissions to access location in the background,
support for biometric authentication.
17. Android 11 :- operating system is the eleventh big release of Android.
-It is the 18th version of Android mobile OS, which was released on 8 September
2020.
-The alphabetic naming system of Android, based on deserts, was stopped since
Android 10. So therefore, this operating system has branded with "Android 11".
*Android Activity:-
-Dalvik uses Dalvic byte code which is different from Java byte code.
-Java class files cannot directly run on Android, they need to be converted into Dalvic byte
code format by the Dex compiler.
DVM uses its own byte code and runs JVM uses java byte code and runs “.class”
“.Dex” file. file
DVM supports Android operating system JVM supports multiple operating systems.
only.
For DVM very few Re-tools are available For JVM many Re-tool are available
-We have seen that android mobile screen size are different from device to device,
some mobile sizes are same. Suppose we are developing one application which
contains a text field and button, when the application changes from one mobile to
the other mobile then the problem is regarding the layout of the component. It
happens because the size of screen varies.
-Now we are having two options,
a) fill parent:-The component wants to display as big as its parent and fill in the
remaining spaces.
->fill_parent_width:-Change the layout_width" to "fill_parent”, now, the
button's width will fill in the remaining spaces,just as big as it's parent
"RelativeLayout",
-but button's height is still big enough to enclose it's content only.
->fill_parent_height:-Change the "layout_height" to "fill_parent”, now, the
button's height will fill in the remaining spaces, just as big as it's parent
"RelativeLayout",
-but button's width is still big enough to enclose it's content only.
->fill_parent_width, height:-Change the both "layout_width” and
"layout_height” to “fill_parent”,
-the button will display as big as the whole device screen, it just fill in the
entire screen space.
b) wrap_content:-The component want to display as big enough to enclose its
content only.
eg ; A button component, set "wrap_content" on both width and height
attribute. It tell Android display the button big enough to enclose it's
content only.
->Attributes;
● Layout_width:-it specifies the width of the view or viewgroup
● Layout_height:-it specifies the height of the view or viewgroup
● layout_marginTop:- it specifies extra space on the top side of the view or
viewgroup
● layout_marginBottom:-it specifies extra space on the bottom side of the view
or viewgroup
● layout_marginLeft:- it specifies extra space on the left side of the view or
viewgroup
● layout_marginRight:- it specifies extra space on the right side of the view or
viewgroup
2.Absolute Layout:-An Absolute Layout lets you specify exact locations
(x/y coordinates) of its children.
-Absolute layouts are less flexible and harder to maintain
than other types of layouts .
-Absolute layouts is based on the simple idea
of placing each control at an absolute position.
-> Attributes
● layout_x:- This specifies the x-coordinate of the view
● layout_y:- This specifies the y-coordinate of the view.
-By default, all child views are drawn at the top-left of the layout, so you must define the
position of each view using the various layout properties available from RelativeLayout.
Module 2
#Android User Interface:-The user interface (UI) for an Android app is built as
a hierarchy of layouts and widgets.
-The layouts are ViewGroup objects, containers that control how their child views are
positioned on the screen.
-Widgets are View objects, UI components such as buttons and text boxes.
->Fragments:- introduced in Android 3.0 which uses API level 11, are used to
encapsulate portions of your UI.
-This encapsulation makes Fragments useful when optimizing your UI layouts for
different
screen sizes.
-and creating reusable user interface (UI).
->Activities :- Activities, represent a single screen that user interact .
- To display a UI, we assign a View (usually a layout or Fragment) to an Activity.
#Layout Manager:-In case of java application there are many layouts found they are;
● Flow Layout: This is a default layout of applet.
- it is used to arrange the components in a line, one after another (in a flow).
● Border Layout: This is default layout of frame.
-The BorderLayout is used to arrange the components in five regions: north, south,
east, west, and center.
-Each region (area) may contain one component only.
-the default position is border layout is center.
● Grid Layout: This layout divides the frame into row and column.
● Card Layout:-his layout clicks the first panel so that second panel is visible and goes
on.
● BoxLayout:- is used to arrange the components either vertically or horizontally.
● Null layout:-his layout can placed the visual component in any position of frame or
applet.
#User interface with View:-It is very important to design a good looking page for
apps in android.
-with the help of GUI like TextView,Button,CheckBox etc,make better in android
*Text View:-TextView displays text to the user and optionally allows them to edit it.
-A TextView is a complete text editor, however the basic class is configured to not allow
editing.
->properties /Attributes of TextView
● Alpha:-alpha property of the view, as a value between 0 and 1
● Auto link :-Control links such as urls and email addresses are automatically found and
converted to clickable links.
● fontFamily:- Font family (named by string) for the text.
● Clickable:-Defines whether this view reacts to click events
● Cursor visible:-Makes the cursor visible or invisible.
● Id:- Supply an identifier name of this view, to later retrieve it with
View.findViewById()./ This is the ID which uniquely identifies the control.
● Input type:-the type of data being placed in a text field.
● Max height: makes the textview be at most this many pixels tall.
● Min height: makes the textview be at least this many pixels tall.
● Text:- text to display.
*Button:-A push button which can be pressed or clicked by the user to perform an action.
->properties/attributes of Button:-
● Auto link: Controls links such as urls and email addresses are automatically found
and converted to clickable links.
● Background: To use as the background. [reference, color].
● Cursor visible:-Makes the cursor visible or invisible.
● Id:- Supply an identifier name of this view, to later retrieve it with
View.findViewById()./ This is the ID which uniquely identifies the control.
● id:- This supplies an identifier name for this view.
● Text:- text to display.
*Image Button:- A push button for which you can specify a customized background
image (Drawable).
->Properties of ImageButton
● Background: To use as the background. (reference, color]
● Clickable:-Defines whether this view reacts to click events
● Id:- Supply an identifier name of this view, to later retrieve it with
View.findViewById()./ This is the ID which uniquely identifies the control.
● cropToPadding:- If true, the image will be cropped to fit within its padding.
● contentDescription:- This defines text that briefly describes content of the view.
● src:- This sets a drawable as the content of this ImageView.
● Text:- text to display.
*Edit Text:-A EditText is an overlay over TextView that configures itself to be editable.
-It is the predefined subclass of TextView that includes
rich editing capabilities.
->Properties of Edit Text;
● autoText:- If set, specifies that this TextView has a textual input method and
automatically corrects some common spelling errors.
● drawableBottom:- This is the drawable to be drawn below the text.
● drawableRight:- This is the drawable to be drawn to the right of the text.
● background:- This is a drawable to use as the background.
● id:- This supplies an identifier name for this view.
● Text:- text to display.
->properties of AutoCompleteTextView
● Completion hint: Defines the hint displayed in the drop down menu.
● Completion hint view: Defines the hint view displayed in the drop down menu.
● Content description: Defines text that briefly describes content of the view.
● Text is selectable: Indicates that the content of a non-editable selected.
● completionThreshold:- the number of characters that the user must type before
completion suggestions are displayed in a drop down menu.
● dropDownHeight:- It specifies the basic height of the dropdown.
● dropDownWidth:- This specifies the basic width of the dropdown.
*Spinner:-spinner is like the drop down menu with multiple values from which the end
user can select only one value.
-Spinner is a view similar to the dropdown list
which is used to select one option from the
list of options.
-It provides an easy way to select one item
from the list of items and it shows a
dropdown list of all values when we click on it.
-The default value of the android spinner will be the currently selected value.
->properties of spinner
● Id:- Used to specify the id of the view.
● textAlignment:- Used to the text alignment in the dropdown list.
● background:- Used to set the background of the view.
● padding:- Used to set the padding of the view.
● visibility:- Used to set the visibility of the view.
● gravity:- Used to specify the gravity of the view like centre, top, bottom, etc.
● Spinner mode:- Display mode for spinner option.
*List View:- ListView is a view which groups several items and display them in vertical
scrollable list.
-The list items are automatically inserted to the list using an Adapter that pulls content from
a source such as an array or database.
->properties of List View;
● id:- This is the ID which uniquely identifies the layout.
● dividerHeight:- This specifies height of the divider. This
could be in px, dp, sp, in, or mm.
● Stack from bottom:- used to stack their content from
the bottom.
● List selector:- Drawable used to indicate the currently
selected item in the list.
*Scroll View:-A ScrollView is a view group that is used to make vertically scrollable views.
- A scroll view contains a single direct child only.
- A ScrollView supports Vertical scrolling only, so in order to create a horizontally scrollable
view, Horizontal scroll view is used.
*Custom Toast Alert:- A toast is a view containing a quick little message for the user.
-In Android, Toast is used to display information for a period of time.
-It contains a message to be displayed quickly and disappears after specified period of time.
->Methods
● makeText:- (Context context, CharSequence text, int duration): This method is used
to initiate the Toast.
-This method take three parameters First is for the application Context, Second is
text message and last one is duration for the Toast.
a. LENGTH_LONG:- It is used to display the Toast for a long period of time.
When we set this duration the Toast will be displayed for a long duration.
b. LENGTH_SHORT: It is used to display the Toast for short period of time.
When we set this duration the Toast will be displayed for short duration.
● show():- This method is used to display the Toast on the screen.
● setText:- This method is used to set the text for the Toast.
*Time and Date Picker:- Date picker is widget for selecting a date.
-The date should be able to be selected by a year, month, and spinners or a Calendar view.
->property of Date picker
● getDayOfMonth():- This method gets the selected day of month.
● getMonth():- This method gets the selected month.
● getYear():- This method gets the selected year.
● updateDate:- This method updates the current date.
- Time Picker allows you to select the time of day in either 24 hour or AM/PM mode.
-The time consists of hours, minutes and clock format.
->property of time
● setCurrentHour:- This method sets the current hour.
● setCurrentMinute:- This method sets the current minute.
Module 3
#Activity :-An activity represents a single screen with a user interface just like window.
-Android activity is the subclass of ContextThemeWrapper class.
-Depending on the application, there can be single to multiple
activities, meaning one or more screens.
-Android apps start from a main activity and from there additional
activities can be opened.
-The activities could be independent of one another
Eg;using the camera application to take photos in facebook.
-Another example
Example-Facebook app provides an activity to log into the application.
There could be other activities like posting a photograph, send a message to a friend etc.
-There are two methods to implement Activity they are;
● onCreate(Bundle):- method in which we initialize our activity.
- Here we usually call setContentView(int) with a layout resource defining the UI and
findVewbyId(id)to retrieve the widgets in that UI that we need to interact with
programmatially.
● onPause():-another method in which we deal with the user leaving the activity.
-Any changes made by the user at this point be committed.
->Intent structure:-In Android intents are the message passing mechanisms to communicate
an action.
● action:-- general action to be performed such as ACTION_VIEW , ACTION_EDIT ,
ACTION_MAIN etc
● data:-Data to operate on such as a person record in the contact database ,expressed
as a URI.
*Types of intents:-There are two type of intent they are;
1. Explicit intent:-Explicit Intent specifies the component.
-Explicit intent going to be connected internal world of application,suppose if
you wants to connect one activity to another activity, we can do this by
explicit intent.
example, there are two activities (FirstActivity, SecondActivity). When you
click on the ‘GO TO OTHER ACTIVITY’ Button in the FirstActivity, then you
move to the SecondActivity. When you click on the ‘GO TO HOME
ACTIVITY’
button in the SecondActivity, then you move to the first activity. This is
getting done through Explicit Intent.
2. Implicit intent:-Implicit Intent doesn’t specify the component.
- An action to be performed is declared by implicit intent.
For example, if you want to show the user a location on a map, you can
use an implicit intent to request that another capable app show a
specified location on a map.
*Activity Life Cycle/ Activity life cycle diagram :- Activities in the system are
managed as an activity stack.
-When a new activity is happening, it is placed on the top of the stack and becomes the
running activity.
-The activity always remains below it in the stack, and will not come to the foreground again
until the new activity exits.
-fig
-1.Another foregrounds comes to the foreground.
-2.The activity is no longer.
-3.The activity is finishing or being destroyed by the system
-4.APPs with higher priority need money.
-5.User navigates to the activity
-6.User returns to the activity.
-7.User navigates to the activity
-OR—---------------------------------------------->
-7 lifecycle methods of android activity.
They are—--- (next page)
Method Description
onResume called when activity will start interacting with the user.
*Broadcast Life Cycle:- A broadcast receiver is a component that do nothing but receive
and react to broadcast announcements.
-roadcast Receivers simply respond to broadcast messages from other applications or from
the system itself.
-These messages are sometime called events or intents.
For example, applications can also initiate broadcasts to let other applications know
that some data has been downloaded to the device and is available for them to use,
so this is broadcast receiver who will intercept this communication and will initiate
appropriate action.
-There are mainly two types of Broadcast Receivers:
● Static Broadcast Receivers: These types of Receivers are declared in the manifest
file and works even if the app is closed.
● Dynamic Broadcast Receivers: These types of receivers work only if the app is
active or minimized.
* Play Audio and Video:-2 types of classes to play audio and video in android.
->Play Audio:-We can play and control the audio files in android by the help of MediaPlayer
class.
-The android.media.MediaPlayer class is used to control the audio or video files.
-some methods of MediaPlayer class are;
public void start() it starts or resumes the playback
->Video:-By the help of MediaController and VideoView classes, we can play the video files
in android.
-The android.widget.MediaController is a view that contains media controls like
play/pause, previous, next, fast-forward, rewind etc.
-The android.widget.VideoView class provides methods to play and control the video
player.
-The commonly used some methods of VideoView class are;
Method Description
*Sensors:- A sensors is a piece of hardware wired into the device feeding data from the
physical world to application.
-Android device come with build in sensors and provide a framework for working with
sensors.
-working with sensors is real fun in android.
-Sensors are easy to use.
-Sensors can operate in one direction only and read-only.
-some of the sensors type are ;
● Light sensor:-used for control screen brightness.
● Proximity sensor:- Phone position during a call
● Temperature sensor:-monitoring air temperature
● pressure sensor:-monitoring air pressure change
● Magnetic field sensor:- creating compass.
-Android support 3 categories of sensors:
● Motion sensors:- These sensors measure acceleration forces and rotating forces
along three axes.
-This category include gravity sensors , accelerators,gyroscopes and rotational
sensors.
● Environmental sensors:-These sensors measure various environmental parameter.
-This category includes photometers,thermometers etc
● Position sensors:- These sensors measure the physical position of a device.
-this category includes orientation sensors and magnetometers.
Module 4
Step 1:
-Import android.database.sqlite.
-This method is used to create/open database. As the name suggests, it will open a
database connection if it is already there, otherwise, it will create a new one.
Step 2: Execute DDL command
- This command is used to execute a single SQL statement that doesn't return any data
means other than SELECT or any other.
-Try and Catch block is required while performing this operation.
-An exception that indicates there was an error with SQL parsing or execution.
Step 3: Create an object and Initiate it.
-This class is used to store a set of values.
-We can also say, it will map ColumnName and relevant ColumnValue.
Step 4: Perform Insert Statement.
-This method returns a long. The row ID of the newly inserted row, or -1 if an error
occurred.
Step 5: Create Cursor
-This interface provides random read-write access to the result set returned by a database
query.
Step 6: Close Cursor and Close Database connectivity
- It is very important to release our connections before closing our activity.
-It is advisable to release the Database connectivity in "onStop" method. And Cursor
connectivity after using it.
*How can we create the Tables?:- After executing the statements the table is created on
the database.
-The queries are executed by the execSQL() statement.
*Updating data in the database:-The update() method is used to update the records
in the database.
-The update() supports WHERE syntax.
-It Contains 2 parameters 1.Tablename 2.ContentValues instance.
* Deleting data from the database:-Delete() method has 3 parameters
a.Database name.
b.WHERE clause.
c.An argument array for the WHERE clause.
-To delete all the records from a table pass null for the WHERE clause and WHERE clause
argument array.
*Database – Fetching / Extracting values from Cursors :-We can retrieve anything
from database using an object of the Cursor class.
-We will call a method of this class called rawQuery and it will return a resultset with the
cursor pointing to the table.
- We can move the cursor forward and retrieve the data.
-There are other functions available in the Cursor class that allows us to effectively retrieve
the data they are;
● getColumnCount():- This method return the total number of columns of the table.
● getColumnNames():- This method returns the array of all the column names of the
table.
● getCount():- This method returns the total number of rows in the cursor.
● getPosition():- This method returns the current position of the cursor in the table.
*Sending SMS:-In Android, we can use SmsManager API or devices Built-in SMS
application to send SMS's.
- Both need SEND_SMS permission to send SMS.
*Wi-Fi Activity:-Android allows applications to view the state of the wireless connections
at very low level.
-Application can access almost all the information of a wifi connection.
-Android provides WifiManager API to manage all aspects of WIFI connectivity.
-bakki thanna ezhuthukka
*Uses of JSON
-JSON ina kurichu ezhuthiyal mathi
JSON doesn’t use end tag In XML, the end tag is mandatory
JSON is less secure than XML XML is more secured than JSON
JSON file is more readable than XML because it is short XML file is big and filled with user-
and to the point. defined tags, thus less-readable
#Google Play services:- With google play services,your app takes advantage of
the latest google powered features such as maps,cast and more.
-It runs in the background and manages notifications, location etc.
-Google is not putting all updates into the android os but has been pushing updates
through google apps and services.
-bakki thanna ezhuthukaa..