Professional Documents
Culture Documents
Android and It's Tool
Android and It's Tool
Unit I 04
Android andand
Networking it’s Tool
Security
Hours: 04 Marks: 04
Presented by:
Prof.S.S.Bhosale
Pravara Polytechnic Loni
Socket
Specific Objective
• Released on September
❑ Network socket is an endpoint of an inter-
15, 2009.
process communication
• Quick search box. flow across a
computer network.
• Screen size diversity.
❑ Sockets provide
• Google play. the communication
mechanism between two computers using
TCP/IP.
Socket
ECLAIR ANDROID 2 API LEVEL 5,6,7
• Released on October
❑ Network socket is an endpoint of an inter-
26, 2009.
process
• Google communication
maps navigation. flow across a
computer network.
•Home screen
❑ Sockets provide the communication
customization.
mechanism
• Speech tobetween
text. two computers using
TCP/IP.
Socket
FROYO ANDROID 2.2 API LEVEL 8
• Released on December
❑ Network socket is an endpoint of an inter-
6, 2010.
•process
Support forcommunication
multiple flow across a
computer network.
cameras.
• Gaming APIs, NFC.
❑ Sockets provide the communication
• Battery management
mechanism between two computers using
TCP/IP.
HONEYCOMB ANDROID 3.0, 3.1, 3.2
Socket
API LEVEL 11, 12, 13
• Released in February
❑ Network socket is an endpoint of an inter-
22, 2011.
process
• Tablet communication
friendly design. flow across a
computer network.
• System bar.
• Quick settings.
❑ Sockets provide the communication
mechanism between two computers using
TCP/IP.
ICE-CREAM SANDWICH ANDROID 4.0,4.0.3
Socket
API LEVEL 14,15
• Released on July 9,
Network socket is an endpoint of an inter-
❑2012.
process communication
• Google Now. flow across a
computer network.
• Actionable notification.
❑ •Sockets provide
Switchable the communication
account.
mechanism between two computers using
TCP/IP.
KITKAT
Socket
ANDROID 4.4, 4.4.W API LEVEL 19, 20
• Released on November
❑ Network socket is an endpoint of an inter-
12, 2014.
process
• Materialcommunication
Design. flow across a
computer network.
• Notification.
❑ Sockets provide the communication
• Multiscreen.
mechanism between two computers using
TCP/IP.
MARSHMALLOW ANDROID 6.0
Socket
API LEVEL 23
• Released on October 5,
❑ Network socket is an endpoint of an inter-
2015.
process
• Now communication
on tap. flow across a
computer network.
• Permission can be
turned off.
❑ Sockets provide the communication
• mechanism
Doze and appbetween
standby two computers using
TCP/IP.
for battery optimization.
NOUGAT ANDROID 7.0
Socket
API LEVEL 24
• Released on 22 August
❑ Network socket is an endpoint of an inter-
2016.
process communication flow across a
• Multi window.
computer network.
• Notification sheets.
• Switch
❑ Sockets provide
apps the communication
by double
mechanism
tapping between two computers using
in overview
TCP/IP.
button.
Android 8.0 Oreo
1. Android User:
SMARTWATCHES
ANDROID ECOSYSTEM
MOBILE PHONES
ANDROID ECOSYSTEM
ANDROID TABLETS
ANDROID ECOSYSTEM
SMART TVs
ANDROID ECOSYSTEM
SMART GLASSES
ANDROID ECOSYSTEM
HOME APPLIANCES
ANDROID ECOSYSTEM
3. Developer :
• Android developer is specialist software developer in designing
application for android.
• Design and build advanced application for the android platform.
• Collaborate and define with development teams for design new
feature.
• Troubleshoot and fix bugs in new and existing applications.
• Evaluate and implement new development tools work with
outside data sources and API’s.
Need of Android
1. Android Market
2. Customization
3. Rooting
4. The Android Community
5. Powerful Development Framework
6. Global Partnerships and large installed base
FEATURES OF ANDROID
1 Beautiful UI
Android OS basic screen provides a beautiful and intuitive user interface.
2 Connectivity
GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi, LTE, NFC
and WiMAX.
3 Storage
SQLite, a lightweight relational database, is used for data storage purposes.
4 Media support
H.263, H.264, MPEG-4 SP, AMR, AMR-WB, AAC, HE-AAC, AAC 5.1,
MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP.
FEATURES OF ANDROID
6 Web browser
Based on the open-source WebKit layout engine, coupled with Chrome's V8
JavaScript engine supporting HTML5 and CSS3.
7 Multi-touch
Android has native support for multi-touch which was initially made
available in handsets such as the HTC Hero.
8 Multi-tasking
User can jump from one task to another and same time various application
can run simultaneously.
9 Resizable widgets
Widgets are resizable, so users can expand them to show more content or
shrink them to save space.
FEATURES OF ANDROID
❖ Application
• Android will ship with a set of core applications including an
email client, SMS program, calendar, maps, browser,
contacts, and others. All applications are written using the Java
programming language.
ANDROID ARCHITECTURE
❖ Application Framework
• The application framework provides the classes used to create
Android applications. It also provides a generic abstraction
for hardware access and manages the user interface and
application resources.
ANDROID ARCHITECTURE
❖ Libraries
• On the top of Linux kernal.
• Webkit library used for browser support.
• FreeType for Font support.
• SQLite for database support.
ANDROID ARCHITECTURE
❖ Android Runtime
• Android includes a set of core libraries that provides most of the
functionality available in the core libraries of the Java programming
language.
• Every Android application runs in its own process, with its own
instance of the Dalvik virtual machine.
• Dalvik has been written so that a device can run multiple VMs
efficiently.
ANDROID ARCHITECTURE
❖ Linux Kernel
• It is core of android OS that exists at the root of android
architecture.
• It is responsible for device driver, power management,
memory management, device management and resource
access.
SOFTWARE FEATURES
OS:
1. Microsoft Windows version
2. Mac OS
3. Linux including GNU C Libraray.
Software:
1. JDK
2. Android Studio
SOFTWARE FEATURES
• Advantages:
1. Multitasking
2. Easy of Notifications
3. Easy access to thousands of applications via the Google
Android Android App Market
4. Can install a modified ROM
5. Widget
6. Voice typing and actions
7. Support VGA,2D & 3D.
• Disadvantages:
1. Continuous Internet connection
2. Advertising
Socket
Thank You
❑ Network socket is an endpoint of an inter-
process communication flow across a
computer network.
Presented by:
Prof.S.S.Bhosale
Pravara Polytechnic Loni
Socket
Specific Objective
❑-Sockets provide
They handle the communication
jobs which are serviced by multiple
mechanism between node
CPUs. Each individual two holds
computers using
a specific
TCP/IP.
software subset of the global aggregate operating
system.
- Remote access is enable by using distributed OS.
Socket
4. Network Operating System:
1. JVM:
❑ Network socket
Java Virtual is an endpoint of an inter-
Machine
process communication flow across a
2.computer
JRE network.
Java Runtime Environment
❑ Sockets provide the communication
3. JDK
mechanism between two computers using
TCP/IP.
Java development Kit
Socket
2.1.2.1 Working of JVM
1. Android Studio
❑ Network socket is an endpoint of an inter-
2.process communication
Visual Studio flow across a
with Xamarin
computer network.
3. Eclipse
❑ Sockets provide the communication
mechanism between two computers using
TCP/IP.
Socket
2.3 Android Virtual Devices
- Android Virtual device (AVD) is configuration
❑ Network
that definessocket is an endpoint
the characteristics of an inter-
of an android phone,
process communication
tablet, android flowtoacross
TV that you want a in
simulate
computer network.
android emulator.
• ❑ItNetwork
provides asocket is navigation
variety of an endpointandof an inter-
control keys,
process
which communication
you can "press" usingflow
your across
mouse ora keyboard
tocomputer network.
generate events for your application.
❑ Network
logic operations socket
through push is
and an endpoint oflocated
an ininter-
Stack-based VM that performs arithmetic and Register-based VM that uses
pop operands. registers the CPU to
process communication
is stored in stack flowperform
across a
1
The result of operations arithmetic and logic
memory. operations.
computer network.
Source code files are first of all
compiled into Java bytecode
Compiled bytecode size is compact because the Compiled bytecode size is larger
4 location of the operand is implicitly on the as each instruction needs all
❑ Network socket is an endpoint of an inter-
operand stack. implicit operands.
Supports multiple operating systems like Linux, Support only the Android
7
Windows, and Mac OS. operation system.
Socket
2.6 Steps to install and configure Android Studio and SDK
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
Step – 7:
Here is the Welcome Screen.
Step – 8:
Here click on Standard option
Step – 9:
It will ask for the UI Theme, by default it would be IntelliJ, then directly you can click
on Next.
❑ Network socket is an endpoint of an inter-
process communication flow across a
computer network.
Step – 10:
It will ask for the confirmation for installation setting wizard.
Step – 11:
It will download all necessary components to launch the Android Studio and setting up
the environment
❑ Network socket is an endpoint of an inter-
process communication flow across a
computer network.
UI Components
Networking andand Layouts
Security
Hours: 08 Marks: 08
Presented by:
Prof. S.S.Bhosale
Pravara Polytechnic, Loni
Socket
Specific Objective
Activities :
Services :
A service is a component that runs in the
background to perform long-running operations.
For example, a service might play music in the
background while the user is in a different
application, or it might fetch data over the
network without blocking user interaction with
an activity.
A service is implemented as a subclass
of Service class as follows -
public class MyService extends Service { }
Control Flow
Broadcast Receivers :
Broadcast Receivers simply respond to
broadcast messages from other applications or
from the system. 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.
Control Flow
eg.
public class MyContentProvider extends ContentProvider
{
public void onCreate()
{}
}
Control Flow
A content provider is implemented as a subclass
of ContentProvider class and must implement a
standard set of APIs that enable other applications to
perform transactions.
eg.
public class MyContentProvider extends ContentProvider
{
public void onCreate()
{}
}
3.1.1 Additional Components :
eg.
package com.example.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
3.1.2 .1 The Main Activity File
For example, a default manifest file will look like as following file :
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</manifest>
3.1.2 .2 The Manifest File
<resources>
<string
name="app_name">HelloWorld</string> <string
name="hello_world">Hello world!</string> <string
name="menu_settings">Settings</string> <string
name="title_activity_main">MainActivity
</string>
</resources>
3.1.2 .4 The Layout File
<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" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerVertical="true"
android:padding="@dimen/padding_medium"
android:text="@string/hello_world"
tools:context=".MainActivity" />
</RelativeLayout>
3.1.3 Android UI Controls
android:id="@+id/id_text“/>
3.1.4 Create UI Controls
<Button
android:id=“@+id/b1”
/>
1. Linear Layout
2. Absolute Layout
3. Table Layout
4. Frame Layout
5. Relative Layout
6. Constraints Layout
3.3.1 Linear Layout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is a TextView" />
<Button android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is a Button" />
</LinearLayout>
3.3.1 Linear Layout Attribute
<AbsoluteLayout
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
xmlns:android=”http://schemas.android.com/apk/res/android” >
<Button
android:layout_width=”188dp”
android:layout_height=”wrap_content”
android:text=”Button”
android:layout_x=”126px”
android:layout_y=”361px” />
</AbsoluteLayout>
3.3.2 Absolute Layout
(25,30)
(100,70)
(15,180)
3.3.2 Absolute Layout
2 android:layout_x
This specifies the x-coordinate of the view.
3 android:layout_y
This specifies the y-coordinate of the view.
4 android:layout_width
This is the width of the layout.
5 android:layout_height
This is the height of the layout
3.3.3 Table Layout
2 android:collapseColumns
This specifies the zero-based index of the columns to collapse. The
column indices must be separated by a comma: 1, 2, 5.
3 android:shrinkColumns
The zero-based index of the columns to shrink. The column indices
must be separated by a comma: 1, 2, 5.
4 android:stretchColumns
The zero-based index of the columns to stretch. The column indices
must be separated by a comma: 1, 2, 5.
3.3.3 Relative Layout
4 android:layout_alignParentBottom
If true, makes the bottom edge of this view match the
bottom edge of the parent. Must be a boolean value, either
"true" or "false".
5 android:layout_alignParentEnd
If true, makes the end edge of this view match the end
edge of the parent. Must be a boolean value, either "true"
or "false".
6 android:layout_alignParentLeft
If true, makes the left edge of this view match the left edge
of the parent. Must be a boolean value, either "true" or
"false".
3.3.3 Relative Layout Attributes
7 android:layout_alignParentRight
If true, makes the right edge of this view match the right edge
of the parent. Must be a boolean value, either "true" or "false".
8 android:layout_alignParentStart
If true, makes the start edge of this view match the start edge of
the parent. Must be a boolean value, either "true" or "false".
9 android:layout_alignParentTop
If true, makes the top edge of this view match the top edge of
the parent. Must be a boolean value, either "true" or "false".
3.3.3 Relative Layout Attributes
10 android:layout_alignRight
Makes the right edge of this view match the right edge of the
given anchor view ID and must be a reference to another
resource, in the form "@[+][package:]type:name".
11 android:layout_alignStart
Makes the start edge of this view match the start edge of the
given anchor view ID and must be a reference to another
resource, in the form "@[+][package:]type:name".
12 android:layout_alignTop
Makes the top edge of this view match the top edge of the
given anchor view ID and must be a reference to another
resource, in the form "@[+][package:]type:name".
3.3.3 Relative Layout Attributes
13 android:layout_below
Positions the top edge of this view below the given anchor view
ID and must be a reference to another resource, in the form
"@[+][package:]type:name".
14 android:layout_centerHorizontal
If true, centers this child horizontally within its parent. Must be
a boolean value, either "true" or "false".
15 android:layout_centerInParent
If true, centers this child horizontally and vertically within its
parent. Must be a boolean value, either "true" or "false".
3.3.3 Relative Layout Attributes
16 android:layout_centerVertical
If true, centers this child vertically within its parent. Must be
a boolean value, either "true" or "false".
17 android:layout_toEndOf
Positions the start edge of this view to the end of the given
anchor view ID and must be a reference to another resource,
in the form "@[+][package:]type:name".
18 android:layout_toLeftOf
Positions the right edge of this view to the left of the given
anchor view ID and must be a reference to another resource,
in the form "@[+][package:]type:name".
3.3.3 Relative Layout Attributes
19 android:layout_toRightOf
Positions the left edge of this view to the right of the given
anchor view ID and must be a reference to another resource,
in the form "@[+][package:]type:name".
20 android:layout_toStartOf
Positions the end edge of this view to the start of the given
anchor view ID and must be a reference to another resource,
in the form "@[+][package:]type:name".
3.3.4 Frame Layout
2 android:foreground
This defines the drawable to draw over the content and possible values may be a color
value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
3 android:foregroundGravity
Defines the gravity to apply to the foreground drawable. The gravity defaults to fill.
Possible values are top, bottom, left, right, center, center_vertical, center_horizontal
etc.
4 android:measureAllChildren
Hours: 10 Marks: 12
Presented by:
Prof. S.S.Bhosale
Pravara Polytechnic, Loni
Specific Objective
2 android:capitalize
If set, specifies that this TextView has a textual input method and
should automatically capitalize what the user types.
Don't automatically capitalize anything - 0
Capitalize the first word of each sentence - 1
Capitalize the first letter of every word - 2
Capitalize every character - 3
3 android:cursorVisible
Makes the cursor visible (the default) or invisible. Default is false.
4.1.1 TextView Attributes
Specifies how to align the text by the view's x- and/or y-axis when the text is
smaller than the view.
7 android:hint
The type of data being placed in a text field. Phone, Date, Time, Number,
Password etc.
4.1.1 TextView Attributes
12 android:minWidth
Whether the characters of the field are displayed as password dots instead of
themselves. Possible value either "true" or "false".
4.1.1 TextView Attributes
If set, specifies that this TextView has a phone number input method. Possible
value either "true" or "false".
15 android:text Text to display.
16 android:textAllCaps
Present the text in ALL CAPS. Possible value either "true" or "false".
17 android:textColor
Text color. May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or
"#aarrggbb".
18 android:textColorHighlight
Style (bold, italic, bolditalic) for the text. You can use or more of the
following values separated by '|'.
normal - 0
bold - 1
italic - 2
23 android:typeface
Typeface (normal, sans, serif, monospace) for the text. You can use or
more of the following values separated by '|'.
normal - 0
sans - 1
serif - 2
monospace – 3
4.2 EditText
If set, specifies that this TextView has a textual input method and
automatically corrects some common spelling errors.
2 android:drawableBottom
5 android:text
7 android:contentDescription
This defines text that briefly describes content of the view.
8 android:id
This supplies an identifier name for this view.
9 android:onClick
This is the name of the method in this View's context to invoke when the
view is clicked.
10 android:visibility
This controls the initial visibility of the view.
4.3 AutoCompleteTextView
android:completionHint
1
This defines the hint displayed in the drop down menu.
android:completionHintView
2
This defines the hint view displayed in the drop down menu.
android:completionThreshold
3 This defines the number of characters that the user must type before
completion suggestions are displayed in a drop down menu.
android:dropDownAnchor
4
This is the View to anchor the auto-complete dropdown to.
android:dropDownHeight
5
This specifies the basic height of the dropdown.
4.3.1 AutoCompleteTextView Attributes
Sr.No. Attribute & Description
android:dropDownHorizontalOffset
6 The amount of pixels by which the drop down should be offset
horizontally.
android:dropDownSelector
7
This is the selector in a drop down list.
android:dropDownVerticalOffset
8
The amount of pixels by which the drop down should be offset vertically.
android:dropDownWidth
9
This specifies the basic width of the dropdown.
android:popupBackground
10
This sets the background.
4.4 Button
If set, specifies that this TextView has a textual input method and automatically
corrects some common spelling errors.
2 android:drawableBottom
3 android:drawableRight
4 android:editable
5 android:text
This is the name of the method in this View's context to invoke when the view is
clicked.
5 android:visibility
android:src
5
This sets a drawable as the content of this ImageView.
4.5.1 ImageButton Attributes
Inherited from android.view.View Class
This is the name of the method in this View's context to invoke when the view is
clicked.
5 android:visibility
5 android:text
This is the Text to display.
4.6.1 ToggleButton Attributes
Inherited from android.view.View Class
This is the name of the method in this View's context to invoke when the view is
clicked.
5 android:visibility
Attribute Description
android:checkedButton This is the id of child radio button that should be
checked by default within this radio group.
4.8.1 Radio Group
Inherited from android.view.View Class
This is the name of the method in this View's context to invoke when the view is
clicked.
5 android:visibility
android:drawableRight
3 This is the drawable to be drawn to the right of the text.
android:editable
4 If set, specifies that this TextView has an input method.
android:text
5 This is the Text to display.
4.9.1 CheckBox
Inherited from android.view.View Class
Sr.No Attribute & Description
1 android:background
This is the name of the method in this View's context to invoke when the view is
clicked.
5 android:visibility
Now you can set some properties of this dialog. Such as,
its style, its text etc.
3 android:dividerHeight
This specifies height of the divider. This could be in px, dp, sp, in, or mm.
4 android:entries
Specifies the reference to an array resource that will populate the ListView.
5 android:footerDividersEnabled
When set to false, the ListView will not draw the divider before each footer view.
The default value is true.
6 android:headerDividersEnabled
When set to false, the ListView will not draw the divider after each header view.
The default value is true.
4.11.1 ArrayAdapter
You can use this adapter when your data source is an array.
By default, ArrayAdapter creates a view for each array item
by calling toString() on each item and placing the contents in
a TextView.
Consider you have an array of strings you want to display in a
ListView, initialize a new ArrayAdapter using a constructor
to specify the layout for each string and the string array −
msg.show();
4.16 TimePicker
1. setCurrentHour(Integer currentHour):
This method is used to set the current hours in a time
picker.
2. setCurrentMinute(Integer currentMinute):
This method is used to set the current minutes in a
time picker.
3. getCurrentHour():
This method is used to get the current hours from a
time picker.
4.16.1 Methods of TimePicker
4. getCurrentMinute():
This method is used to get the current minutes from a
time picker.
5. setIs24HourView(Boolean is24HourView):
This method is used to set the mode of the Time
picker either 24 hour mode or AM/PM mode. In this
method we set a Boolean value either true or false.
True value indicate 24 hour mode and false value
indicate AM/PM mode.
6. is24HourView():
4.16.1 Methods of TimePicker
6. is24HourView():
This method is used to check the current mode of the
time picker. This method returns true if its 24 hour
mode or false if AM/PM mode is set.
4.16.1 AttributesTimePicker
1. setSpinnersShown(boolean shown):
This method is used to set whether the spinner of
the date picker in shown or not. In this method you
have to set a Boolean value either true or false. True
indicates spinner is shown, false value
indicates spinner is not shown.
2. getDayOfMonth():
This method is used to get the selected day of the
month from a date picker. This method returns an
integer value.
4.16.1 Methods of DatePicker
3. getMonth():
This method is used to get the selected month from a
date picker. This method returns an integer value.
4. getYear():
This method is used to get the selected year from a
date picker. This method returns an integer value.
5. getFirstDayOfWeek():
This method is used to get the first day of the week.
This method returns an integer value.
4.16.1 Attributes DatePicker
Hours: 18 Marks: 20
Presented by:
Prof. S.S.Bhosale
Pravara Polytechnic, Loni
Specific Objective
eg.
1. action
2. data
3. category
5.1 intent filter
1. action:
CATEGORY_BROWSABLE,
CATEGORY_LAUNCHER.
5.1 intent filter
BROWSABLE – Browsable category, activity allows itself to
be opened with web browser to open the reference link provided
in data.
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver android:name="MyReceiver">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED">
</action>
</intent-filter>
</receiver>
</application>
5.3 Broadcast Receivers
Sr.No Event Constant & Description
android.intent.action.BATTERY_CHANGED
1 Sticky broadcast containing the charging state, level, and other information about the battery.
android.intent.action.BATTERY_LOW
2 Indicates low battery condition on the device.
android.intent.action.BATTERY_OKAY
3 Indicates the battery is now okay after being low.
android.intent.action.BOOT_COMPLETED
4 This is broadcast once, after the system has finished booting.
android.intent.action.BUG_REPORT
5
Show activity for reporting a bug.
android.intent.action.CALL
6
Perform a call to someone specified by the data.
android.intent.action.CALL_BUTTON
7 The user pressed the "call" button to go to the dialer or other appropriate UI for placing a call.
android.intent.action.DATE_CHANGED
8
The date has changed.
5.4 Content provider
2. List fragments:
fragments having special list view is called as list fragment
3. Fragments transaction:
Using with fragment transaction. we can move one fragment to
another fragment.
5.5 Services
A service is a component that runs in the background
to perform long-running operations without needing to
interact with the user and it works even if application
is destroyed.
A service can essentially take two states :
1. Started:
A service is started when an application component,
such as an activity, starts it by calling startService().
Once started, a service can run in the background
indefinitely, even if the component that started it is
destroyed.
5.5 Services
2. Bound:
<uses-permission android:name="android.permission.INTERNET“>
5.6 Android MediaPlayer class
mediaPlayer.start();
mediaPlayer.pause();
mediaPlayer.reset();
5.6 Android MediaPlayer class
mediaPlayer.reset();
5.6 Android MediaPlayer class
<VideoView android:id="@+id/vdv1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
5.7 Video Player
VideoView v1=(VideoView)findViewById(R.id.vdv1);
ttobj.setLanguage(Locale.UK);
- The method setLanguage takes an Locale object as parameter.
- The list of some of the locales available are given below :
Sr.No Locale
1 US
2 CANADA_FRENCH
3 GERMANY
4 ITALY
5 JAPAN
6 CHINA
5.9 Sensors
-Most of the android devices have built-in sensors that measure
motion, orientation, and various environmental condition.
-The android platform supports three broad categories of
sensors.
1. Motion Sensors
2. Environmental sensors
3. Position sensors
Once you enable the Bluetooth , you can get a list of paired
devices by calling getBondedDevices() method.
It returns a set of bluetooth devices.
Its syntax is:
Tween Animation:
- Tween Animation takes some parameters such as start
value , end value, size , time duration , rotation angle etc.
and perform the required animation on that object.
- It can be applied to any type of object.
So in order to use this , android has provided us a class
called Animation.
5.12 Animation
Animation animation =
AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.myanimation);
5.12 Animation
getDuration()
3 This method gets the duration which is set by above method
end()
4
This method ends the animation.
cancel()
5 This method cancels the animation.
5.13 SQLite Database
Database - Creation
In order to create a database you just need to call this
method openOrCreateDatabase with your database name
and mode as a parameter.
It returns an instance of SQLite database which you have to
receive in your own object.
Database - Insertion
we can create table or insert data into table using execSQL
method defined in SQLiteDatabase class.
3 getColumnName(int columnIndex)
This method returns the name of the column by specifying the index of the column
4 getColumnNames()
This method returns the array of all the column names of the table.
5 getCount()
This method returns the total number of rows in the cursor
6 getPosition()
This method returns the current position of the cursor in the table
7 isClosed()
This method returns true if the cursor is closed and return false otherwise
5.13.1 Database Helper class
SQLiteOpenHelper openHelper=new
databaseHelper(this);
SQLiteDatabase db=openHelper.getWritableDatabase();
5.13.1 Database Helper class
Its syntax is given below:
public class databaseHelper extends SQLiteOpenHelper
{
public databaseHelper(@Nullable Context context) {
}
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " +TABLE_NAME+ "(ID INTEGER
PRIMARY KEY AUTOINCREMENT,name TEXT,address
TEXT,phone TEXT,email TEXT)");
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+TABLE_NAME);
onCreate(db);
}
}
Socket
Thank You
❑ Network socket is an endpoint of an inter-
process communication flow across a
computer network.