Professional Documents
Culture Documents
Unit V - Activity and Multimedia With Databases
Unit V - Activity and Multimedia With Databases
Unit V 04
Hours: 10 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.