SlideShare a Scribd company logo
1 of 19
CONTENT PROVIDERS
CONFIDENTIAL INFORMATION
This document is confidential and proprietary information of
Target Soft Systems. Confidential Information includes, but is not
limited to, the following:
Corporate, Employee and Infrastructure Information about Target
Soft Systems.
Target Soft Systems implementation , Training methodology, cost,
project management and quality processes.
Any disclosure of Confidential Information to, or use of it by a
third party (i.e., a party other than authorised , will be damaging to
Target Soft Systems). Ownership of all Confidential Information,
no matter in what media it resides, remains with Target Soft
Systems( TSS ).
Confidential Information in this document shall not be disclosed
outside the buyer’s proposal evaluators and shall not be duplicated,
used, or disclosed – in whole or in part – for any purpose other than
to evaluate this proposal without specific written permission of an
authorized representative of Target Soft Systems.
• * If you want to share data with other applications you can use a
ContentProvider.
• * A ContentProvider allows applications to access data.
• * The access to a ContentProvider is done via an URI (Uniform
Resource Identifier). The basis for the URI is defined in the
declaration of the ContentProvider in the AndroidManifest.xml
file via the android:authorities attribute.
• * Many Android data sources, e.g. the contacts, are accessible
via ContentProviders. Typically the implementing classes for a
ContentProviders provide public constants for the URIs.
 Some of the useful Content Providers are,
 Browser – Stores data such as browser bookmarks, history
 CallLog – Stores data such as missed calls, call details.
 Contacts – Stores Contact Details
 MediaStore – Stores media files such as audio, video and
images
 Settings – Stores the settings of the device and preferences.
 Format of the query string URI (Uniform Resource Identifier)
 <Standard Prefix >://<authority>/<data_path>/<id>
public final Cursor managedQuery (Uri uri, String[] projection,
String selection, String[] selectionArgs, String sortOrder)
Parameters:
uri --The URI of the content provider to query.
projection --List of columns to return.
selection --SQL WHERE clause.
selectionArgs --The arguments to selection, if any ?s are present
sortOrder --SQL ORDER BY clause.
Returns:
The Cursor returned by query ().
import android.provider.CallLog;
import android.database.Cursor;
// Form an array specifying the columns to return.
String[] callLogColumnList = new String[] {
CallLog.Calls.NUMBER,
CallLog.Calls.CACHED_NAME,
CallLog.Calls.DATE, CallLog.Calls.DURATION,
CallLog.Calls.TYPE };
// Get the base URI for the People table in the Contacts content
provider.
Uri callLogs = CallLog.Calls.CONTENT_URI;
Uri callLogs = Uri.parse(“content://call_logs/calls”);
// Make the query.
Cursor managedCursor = managedQuery (callLogs,
callLogColumnList, // which columns to return
null, // Which rows to return (all rows) null,
// Selection arguments (none)
CallLog.Calls.DATE + "DESC" //results in descending
order by date);
MULTIMEDIA
Media Player
MediaPlayer class can be used to control playback of
audio/video files and streams. Playback control of audio/video
files and streams is managed as a state machine.
• publicstatic MediaPlayer create (Context context, Uri
uri, SurfaceHolderholder)
• Added in API level 1
• Convenience method to create a MediaPlayer for a given Uri.
On success, prepare() will already have been called and must
not be called again.
When done with the MediaPlayer, you should
call release(), to free the resources. If not released, too many
MediaPlayer instances will result in an exception.
Parameters
Context the Context to use uri the Uri from which to get
the data source holder the SurfaceHolder to use for displaying the
video
Returns
a MediaPlayer object, or null if creation failed
ACTIVITY LIFE CYCLEACTIVITY LIFE CYCLE
onCreate( )
onStart( )
onPause( )
onResume( )
onStop( )
onRestart( )
onDestroy( )
ACTIVITY LIFE CYCLEACTIVITY LIFE CYCLE
FLOW DIAGRAMFLOW DIAGRAM
Supported Media Formats
Audio Format :
3GPP (.3gp)
 MPEG-4 (.mp4, .m4a)
ADTS raw AAC (.aac, decode in Android 3.1+, encode in
Android 4.0+, ADIF not supported)
MP3 (.mp3)
WAVE (.wav)
MediaPlayer mp = new MediaPlayer();
// Set data source -
setDataSource("/sdcard/path_to_song");
// Play audio
mp.start();
// Pause audio
mp.pause();
// Reset mediaplayer
mp.reset();
// Get song length duration - in milliseconds
mp.getDuration();
// Get current duration - in milliseconds
mp.getCurrentDuration();
// Move song to particular second - used for Forward or Backward
mp.seekTo(positon); // position in milliseconds
// Check if song is playing or not
mp.isPlaying(); // returns true or false
Audio Player
Video Format :
 3GPP (.3gp)
MPEG-4 (.mp4)
WebM (.webm)
Matroska (.mkv, Android 4.0+)
Image Format :
JPEG (.jpg)
GIF (.gif)
PNG (.png)
BMP (.bmp)
Supported Media Formats
VideoView videoView =(VideoView)findViewById(R.id.videoView);
MediaController mediaController= new MediaController(this);
mediaController.setAnchorView(videoView);
Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.one);
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();
videoView.stopPlayback();
videoView.pause();
videoView.isPlaying();
videoView.getDuration();
videoView.getCurrentPosition();
Video Player
THANK YOU

More Related Content

What's hot

File Input & Output
File Input & OutputFile Input & Output
File Input & OutputPRN USM
 
Android contentprovider
Android contentproviderAndroid contentprovider
Android contentproviderKrazy Koder
 
Slice for Distributed Persistence (JavaOne 2010)
Slice for Distributed Persistence (JavaOne 2010)Slice for Distributed Persistence (JavaOne 2010)
Slice for Distributed Persistence (JavaOne 2010)Pinaki Poddar
 
Techniques for Cross Platform .NET Development
Techniques for Cross Platform .NET DevelopmentTechniques for Cross Platform .NET Development
Techniques for Cross Platform .NET DevelopmentJeremy Hutchinson
 

What's hot (8)

File Input & Output
File Input & OutputFile Input & Output
File Input & Output
 
Android contentprovider
Android contentproviderAndroid contentprovider
Android contentprovider
 
Android Insights - 3 [Content Providers]
Android Insights - 3 [Content Providers]Android Insights - 3 [Content Providers]
Android Insights - 3 [Content Providers]
 
Android - Saving data
Android - Saving dataAndroid - Saving data
Android - Saving data
 
Memory management
Memory managementMemory management
Memory management
 
Backendless apps
Backendless appsBackendless apps
Backendless apps
 
Slice for Distributed Persistence (JavaOne 2010)
Slice for Distributed Persistence (JavaOne 2010)Slice for Distributed Persistence (JavaOne 2010)
Slice for Distributed Persistence (JavaOne 2010)
 
Techniques for Cross Platform .NET Development
Techniques for Cross Platform .NET DevelopmentTechniques for Cross Platform .NET Development
Techniques for Cross Platform .NET Development
 

Viewers also liked (12)

Drama titas
Drama titasDrama titas
Drama titas
 
A specially designed training course for ISO 14001
A specially designed training course for ISO 14001A specially designed training course for ISO 14001
A specially designed training course for ISO 14001
 
Prava15
Prava15Prava15
Prava15
 
Governo geral da congregação
Governo geral da congregaçãoGoverno geral da congregação
Governo geral da congregação
 
Redes
RedesRedes
Redes
 
Lps y mw
Lps y mwLps y mw
Lps y mw
 
Diagrama de dotacion de pnal
Diagrama de dotacion de pnalDiagrama de dotacion de pnal
Diagrama de dotacion de pnal
 
Night light: Coadyuvante en el tratamiento de adelgazamiento
Night light: Coadyuvante en el tratamiento de adelgazamientoNight light: Coadyuvante en el tratamiento de adelgazamiento
Night light: Coadyuvante en el tratamiento de adelgazamiento
 
Presentation on Management review by Mr. Bruno Dockx
Presentation on Management review by Mr. Bruno DockxPresentation on Management review by Mr. Bruno Dockx
Presentation on Management review by Mr. Bruno Dockx
 
IADC HSE Amsterdam 2008 Live Auditing System
IADC HSE Amsterdam 2008 Live Auditing SystemIADC HSE Amsterdam 2008 Live Auditing System
IADC HSE Amsterdam 2008 Live Auditing System
 
Clase 26 de enero de 2016 CCI UNU
Clase 26 de enero de 2016 CCI UNUClase 26 de enero de 2016 CCI UNU
Clase 26 de enero de 2016 CCI UNU
 
Ways to maintain sound and high standards of pilotage organizations in our re...
Ways to maintain sound and high standards of pilotage organizations in our re...Ways to maintain sound and high standards of pilotage organizations in our re...
Ways to maintain sound and high standards of pilotage organizations in our re...
 

Similar to Access data with ContentProviders in Android

The unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in AndroidThe unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in AndroidAlessandro Martellucci
 
The unconventional devices for the Android video streaming
The unconventional devices for the Android video streamingThe unconventional devices for the Android video streaming
The unconventional devices for the Android video streamingMatteo Bonifazi
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & DatabasesMuhammad Sajid
 
InterBEE 2016: クラウドをコアにした「デジタル・トランスフォーメーション」が メディア業界に与えるインパクトとは何か?
InterBEE 2016: クラウドをコアにした「デジタル・トランスフォーメーション」が  メディア業界に与えるインパクトとは何か?InterBEE 2016: クラウドをコアにした「デジタル・トランスフォーメーション」が  メディア業界に与えるインパクトとは何か?
InterBEE 2016: クラウドをコアにした「デジタル・トランスフォーメーション」が メディア業界に与えるインパクトとは何か?Daiyu Hatakeyama
 
Securing the Internet of Things - Hank Chavers
Securing the Internet of Things - Hank ChaversSecuring the Internet of Things - Hank Chavers
Securing the Internet of Things - Hank ChaversWithTheBest
 
IRJET - Virtual Data Auditing at Overcast Environment
IRJET - Virtual Data Auditing at Overcast EnvironmentIRJET - Virtual Data Auditing at Overcast Environment
IRJET - Virtual Data Auditing at Overcast EnvironmentIRJET Journal
 
Vortex Tutorial -- Part I
Vortex Tutorial -- Part IVortex Tutorial -- Part I
Vortex Tutorial -- Part IAngelo Corsaro
 
Build Security into the Software with Sparrow
Build Security into the Software with SparrowBuild Security into the Software with Sparrow
Build Security into the Software with SparrowJason Sohn
 
Deep Dive into the OPC UA / DDS Gateway Specification
Deep Dive into the OPC UA / DDS Gateway SpecificationDeep Dive into the OPC UA / DDS Gateway Specification
Deep Dive into the OPC UA / DDS Gateway SpecificationGerardo Pardo-Castellote
 
From JavaEE to Android: Way in one click?
From JavaEE to Android: Way in one click?From JavaEE to Android: Way in one click?
From JavaEE to Android: Way in one click?Sergii Zhuk
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Cloud Foundry UAA as an Identity Gateway
Cloud Foundry UAA as an Identity GatewayCloud Foundry UAA as an Identity Gateway
Cloud Foundry UAA as an Identity GatewayVMware Tanzu
 
Introduction to OESIS Framework
Introduction to OESIS FrameworkIntroduction to OESIS Framework
Introduction to OESIS FrameworkOPSWAT
 
Turmeric SOA - BOF EclipseCon 2011
Turmeric SOA - BOF EclipseCon 2011Turmeric SOA - BOF EclipseCon 2011
Turmeric SOA - BOF EclipseCon 2011kingargyle
 
Application Programming Interface
Application Programming InterfaceApplication Programming Interface
Application Programming InterfaceSeculert
 
OAuth and OEmbed
OAuth and OEmbedOAuth and OEmbed
OAuth and OEmbedleahculver
 
Android session 4-behestee
Android session 4-behesteeAndroid session 4-behestee
Android session 4-behesteeHussain Behestee
 

Similar to Access data with ContentProviders in Android (20)

The unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in AndroidThe unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in Android
 
The unconventional devices for the Android video streaming
The unconventional devices for the Android video streamingThe unconventional devices for the Android video streaming
The unconventional devices for the Android video streaming
 
Android media-chapter 23
Android media-chapter 23Android media-chapter 23
Android media-chapter 23
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
InterBEE 2016: クラウドをコアにした「デジタル・トランスフォーメーション」が メディア業界に与えるインパクトとは何か?
InterBEE 2016: クラウドをコアにした「デジタル・トランスフォーメーション」が  メディア業界に与えるインパクトとは何か?InterBEE 2016: クラウドをコアにした「デジタル・トランスフォーメーション」が  メディア業界に与えるインパクトとは何か?
InterBEE 2016: クラウドをコアにした「デジタル・トランスフォーメーション」が メディア業界に与えるインパクトとは何か?
 
Securing the Internet of Things - Hank Chavers
Securing the Internet of Things - Hank ChaversSecuring the Internet of Things - Hank Chavers
Securing the Internet of Things - Hank Chavers
 
IRJET - Virtual Data Auditing at Overcast Environment
IRJET - Virtual Data Auditing at Overcast EnvironmentIRJET - Virtual Data Auditing at Overcast Environment
IRJET - Virtual Data Auditing at Overcast Environment
 
PrismTech Vortex Tutorial Part 1
PrismTech Vortex Tutorial Part 1PrismTech Vortex Tutorial Part 1
PrismTech Vortex Tutorial Part 1
 
Vortex Tutorial -- Part I
Vortex Tutorial -- Part IVortex Tutorial -- Part I
Vortex Tutorial -- Part I
 
Build Security into the Software with Sparrow
Build Security into the Software with SparrowBuild Security into the Software with Sparrow
Build Security into the Software with Sparrow
 
Deep Dive into the OPC UA / DDS Gateway Specification
Deep Dive into the OPC UA / DDS Gateway SpecificationDeep Dive into the OPC UA / DDS Gateway Specification
Deep Dive into the OPC UA / DDS Gateway Specification
 
From JavaEE to Android: Way in one click?
From JavaEE to Android: Way in one click?From JavaEE to Android: Way in one click?
From JavaEE to Android: Way in one click?
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Application Hosting
Application HostingApplication Hosting
Application Hosting
 
Cloud Foundry UAA as an Identity Gateway
Cloud Foundry UAA as an Identity GatewayCloud Foundry UAA as an Identity Gateway
Cloud Foundry UAA as an Identity Gateway
 
Introduction to OESIS Framework
Introduction to OESIS FrameworkIntroduction to OESIS Framework
Introduction to OESIS Framework
 
Turmeric SOA - BOF EclipseCon 2011
Turmeric SOA - BOF EclipseCon 2011Turmeric SOA - BOF EclipseCon 2011
Turmeric SOA - BOF EclipseCon 2011
 
Application Programming Interface
Application Programming InterfaceApplication Programming Interface
Application Programming Interface
 
OAuth and OEmbed
OAuth and OEmbedOAuth and OEmbed
OAuth and OEmbed
 
Android session 4-behestee
Android session 4-behesteeAndroid session 4-behestee
Android session 4-behestee
 

More from skumartarget

SENSORS AND ITS DETAILS
SENSORS AND ITS DETAILSSENSORS AND ITS DETAILS
SENSORS AND ITS DETAILSskumartarget
 
INTRODUCTION TO RASPI
INTRODUCTION TO RASPIINTRODUCTION TO RASPI
INTRODUCTION TO RASPIskumartarget
 
Wsn in iot updated
Wsn in iot updatedWsn in iot updated
Wsn in iot updatedskumartarget
 
Ravi i ot-security
Ravi i ot-securityRavi i ot-security
Ravi i ot-securityskumartarget
 
Ravi i ot-enablingtechnologies
Ravi i ot-enablingtechnologiesRavi i ot-enablingtechnologies
Ravi i ot-enablingtechnologiesskumartarget
 
Ap plication &amp; research technologies.pptx
Ap plication &amp; research technologies.pptxAp plication &amp; research technologies.pptx
Ap plication &amp; research technologies.pptxskumartarget
 
Dr mgr chennai april 20th april
Dr mgr  chennai april 20th aprilDr mgr  chennai april 20th april
Dr mgr chennai april 20th aprilskumartarget
 

More from skumartarget (16)

SENSORS AND ITS DETAILS
SENSORS AND ITS DETAILSSENSORS AND ITS DETAILS
SENSORS AND ITS DETAILS
 
INTRODUCTION TO RASPI
INTRODUCTION TO RASPIINTRODUCTION TO RASPI
INTRODUCTION TO RASPI
 
Iot intro
Iot introIot intro
Iot intro
 
Wsn in iot updated
Wsn in iot updatedWsn in iot updated
Wsn in iot updated
 
Ravi i ot-security
Ravi i ot-securityRavi i ot-security
Ravi i ot-security
 
Ravi i ot-impact
Ravi i ot-impactRavi i ot-impact
Ravi i ot-impact
 
Ravi i ot-enablingtechnologies
Ravi i ot-enablingtechnologiesRavi i ot-enablingtechnologies
Ravi i ot-enablingtechnologies
 
Bigdata.pptx
Bigdata.pptxBigdata.pptx
Bigdata.pptx
 
Ap plication &amp; research technologies.pptx
Ap plication &amp; research technologies.pptxAp plication &amp; research technologies.pptx
Ap plication &amp; research technologies.pptx
 
Dr mgr chennai april 20th april
Dr mgr  chennai april 20th aprilDr mgr  chennai april 20th april
Dr mgr chennai april 20th april
 
WSN IN IOT
WSN IN IOTWSN IN IOT
WSN IN IOT
 
Cloudcomputing
CloudcomputingCloudcomputing
Cloudcomputing
 
Level 1
Level 1Level 1
Level 1
 
School updated
School updatedSchool updated
School updated
 
ABOUT TSS PPT
ABOUT TSS PPTABOUT TSS PPT
ABOUT TSS PPT
 
ANDROID FDP PPT
ANDROID FDP PPTANDROID FDP PPT
ANDROID FDP PPT
 

Recently uploaded

Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 

Recently uploaded (20)

OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 

Access data with ContentProviders in Android

  • 2. CONFIDENTIAL INFORMATION This document is confidential and proprietary information of Target Soft Systems. Confidential Information includes, but is not limited to, the following: Corporate, Employee and Infrastructure Information about Target Soft Systems. Target Soft Systems implementation , Training methodology, cost, project management and quality processes. Any disclosure of Confidential Information to, or use of it by a third party (i.e., a party other than authorised , will be damaging to Target Soft Systems). Ownership of all Confidential Information, no matter in what media it resides, remains with Target Soft Systems( TSS ). Confidential Information in this document shall not be disclosed outside the buyer’s proposal evaluators and shall not be duplicated, used, or disclosed – in whole or in part – for any purpose other than to evaluate this proposal without specific written permission of an authorized representative of Target Soft Systems.
  • 3. • * If you want to share data with other applications you can use a ContentProvider. • * A ContentProvider allows applications to access data. • * The access to a ContentProvider is done via an URI (Uniform Resource Identifier). The basis for the URI is defined in the declaration of the ContentProvider in the AndroidManifest.xml file via the android:authorities attribute. • * Many Android data sources, e.g. the contacts, are accessible via ContentProviders. Typically the implementing classes for a ContentProviders provide public constants for the URIs.
  • 4.  Some of the useful Content Providers are,  Browser – Stores data such as browser bookmarks, history  CallLog – Stores data such as missed calls, call details.  Contacts – Stores Contact Details  MediaStore – Stores media files such as audio, video and images  Settings – Stores the settings of the device and preferences.  Format of the query string URI (Uniform Resource Identifier)  <Standard Prefix >://<authority>/<data_path>/<id>
  • 5.
  • 6. public final Cursor managedQuery (Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) Parameters: uri --The URI of the content provider to query. projection --List of columns to return. selection --SQL WHERE clause. selectionArgs --The arguments to selection, if any ?s are present sortOrder --SQL ORDER BY clause. Returns: The Cursor returned by query ().
  • 7. import android.provider.CallLog; import android.database.Cursor; // Form an array specifying the columns to return. String[] callLogColumnList = new String[] { CallLog.Calls.NUMBER, CallLog.Calls.CACHED_NAME, CallLog.Calls.DATE, CallLog.Calls.DURATION, CallLog.Calls.TYPE }; // Get the base URI for the People table in the Contacts content provider. Uri callLogs = CallLog.Calls.CONTENT_URI; Uri callLogs = Uri.parse(“content://call_logs/calls”);
  • 8. // Make the query. Cursor managedCursor = managedQuery (callLogs, callLogColumnList, // which columns to return null, // Which rows to return (all rows) null, // Selection arguments (none) CallLog.Calls.DATE + "DESC" //results in descending order by date);
  • 10. Media Player MediaPlayer class can be used to control playback of audio/video files and streams. Playback control of audio/video files and streams is managed as a state machine. • publicstatic MediaPlayer create (Context context, Uri uri, SurfaceHolderholder) • Added in API level 1 • Convenience method to create a MediaPlayer for a given Uri. On success, prepare() will already have been called and must not be called again.
  • 11. When done with the MediaPlayer, you should call release(), to free the resources. If not released, too many MediaPlayer instances will result in an exception. Parameters Context the Context to use uri the Uri from which to get the data source holder the SurfaceHolder to use for displaying the video Returns a MediaPlayer object, or null if creation failed
  • 12. ACTIVITY LIFE CYCLEACTIVITY LIFE CYCLE onCreate( ) onStart( ) onPause( ) onResume( ) onStop( ) onRestart( ) onDestroy( )
  • 13. ACTIVITY LIFE CYCLEACTIVITY LIFE CYCLE FLOW DIAGRAMFLOW DIAGRAM
  • 14.
  • 15. Supported Media Formats Audio Format : 3GPP (.3gp)  MPEG-4 (.mp4, .m4a) ADTS raw AAC (.aac, decode in Android 3.1+, encode in Android 4.0+, ADIF not supported) MP3 (.mp3) WAVE (.wav)
  • 16. MediaPlayer mp = new MediaPlayer(); // Set data source - setDataSource("/sdcard/path_to_song"); // Play audio mp.start(); // Pause audio mp.pause(); // Reset mediaplayer mp.reset(); // Get song length duration - in milliseconds mp.getDuration(); // Get current duration - in milliseconds mp.getCurrentDuration(); // Move song to particular second - used for Forward or Backward mp.seekTo(positon); // position in milliseconds // Check if song is playing or not mp.isPlaying(); // returns true or false Audio Player
  • 17. Video Format :  3GPP (.3gp) MPEG-4 (.mp4) WebM (.webm) Matroska (.mkv, Android 4.0+) Image Format : JPEG (.jpg) GIF (.gif) PNG (.png) BMP (.bmp) Supported Media Formats
  • 18. VideoView videoView =(VideoView)findViewById(R.id.videoView); MediaController mediaController= new MediaController(this); mediaController.setAnchorView(videoView); Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.one); videoView.setMediaController(mediaController); videoView.setVideoURI(uri); videoView.requestFocus(); videoView.start(); videoView.stopPlayback(); videoView.pause(); videoView.isPlaying(); videoView.getDuration(); videoView.getCurrentPosition(); Video Player