MediaRecorder Android

To record audio and video files, the MediaRecorder class can be used. A sound file can also be created after recording the media. This file can be played later. Example: In the below example, we are demonstrating the usage of the Android MediaRecorder class to record the audio file. We are also using the MediaRecorder … Read more

Video Player Android

The video files can be played in android by using the MediaController and VideoView classes. MediaController class: The media controls like play/pause, previous, next, fast-forward, rewind, etc., are contained in the android.widget.MediaController. It is a view. VideoView class: To play and control the video player, the methods of the android.widget.VideoView class are used. Some of … Read more

Media Player Android

The MediaPlayer class in Android is used to play and control audio files. MediaPlayer class: For controlling the audio or video files, the android.media.MediaPlayer class is used. Methods of MediaPlayer class: The MediaPlayer class contains many methods. Some of the important methods of the MediaPlayer class are: Method Uses public void setDataSource(String path) It is … Read more

Android JSON Parser

JSON stands for the Javascript Object Notation. It is a programming language, minimal, textual, and a subset of JavaScript and an alternative to XML. We can parse the JSON object and array in Android. Advantages of JSON over XML: Compared to XML, JSON is easier and faster for AJAX applications. Compared to XML, JSON is … Read more

XMLPullParser Android

To parse the XML file, the XMLPullParser is recommended in Android. It is faster than the SAX and DOM parser. To parse the XML document using the XMLPullParser, the org.xmlpull.v1.XmlPullParser interface is used. Events of XmlPullParser: To move the cursor pointer to the next event, the next() method of the XMLPullParser is used. The four … Read more

Android XML Parsing using DOM Parser

The DOM parser can also be used to create and parse the XML file, just like the SAX parser. Advantage of DOM Parser over SAX: To parse the XML file, the SAX parser can be used, but cannot be used to create the XML file. The DOM parser can be used to do both. Disadvantage … Read more

Android XML Parsing using SAX Parser

Using the SAX, DOM, etc., that are used as parsers, we can parse the XML file in Android. The SAX parser can be used to parse the XML file only and not to create the XML file. Advantage of SAX Parser over DOM: Compared to DOM, the SAX parser consumes less memory. Example: activity_main.xml: In … Read more

Android SQLite Example with Spinner

To perform the operations on the SQLite, the SQLiteOpenHelper class needs to be extended. In the DatabaseHandler class, the onCreate() and onUpgrade() methods of SQLiteOpenHelper class are overridden. It provides additional methods to insert and display the labels or data. Android SQLite Spinner Example: In the below example, we are using the SQLite database to … Read more

Android SQLite

To perform database operations on android devices, the SQLite is used in Android. It is an open-source relational database that is used for storing, manipulating, or retrieving persistent data from the database. By default, SQLite is embedded in android, thus there is no need to perform any database setup or administration task. SQLiteOpenHelper class: The … Read more

External Storage Android

To save or read data from a device’s external memory such as an SD card, with the help of the FileInputStream and FileOutputStream classes, the Android External Storage is used. Example: To read and write data to the android internal storage: activity_main.xml: In the activity_main.xml file, we will drag the EditTexts, TextViews, and buttons from … Read more