Book Image

Android Studio 3.5 Development Essentials - Java Edition

By : Neil Smyth
Book Image

Android Studio 3.5 Development Essentials - Java Edition

By: Neil Smyth

Overview of this book

Android applications have become an important part of our daily lives and lots of effort goes into developing an Android application. This book will help you to build you own Android applications using Java. Android Studio 3.5 Development Essentials – Java Edition first teaches you to install Android development and test environment on different operating systems. Next, you will create an Android app and a virtual device in Android Studio, and install an Android application on emulator. You will test apps on physical Android devices, then study Android Studio code editor and constraint layout, Android architecture, the anatomy of an Android app, and Android activity state changes. The book then covers advanced topics such as views and widgets implementation, multi-window support integration, and biometric authentication, and finally, you will learn to upload your app to Google Play console and handle the build process with Gradle. By the end of this book, you will have gained enough knowledge to develop powerful Android applications using Java.
Table of Contents (86 chapters)
86
Index

69.2 Introducing the Android MediaController Class

If a video is simply played using the VideoView class, the user will not be given any control over the playback, which will run until the end of the video is reached. This issue can be addressed by attaching an instance of the MediaController class to the VideoView instance. The MediaController will then provide a set of controls allowing the user to manage the playback (such as pausing and seeking backwards/forwards in the video time-line).

The position of the controls is designated by anchoring the controller instance to a specific view in the user interface layout. Once attached and anchored, the controls will appear briefly when playback starts and may subsequently be restored at any point by the user tapping on the view to which the instance is anchored.

Some of the key methods of this class are as follows:

setAnchorView(View view) – Designates the view to which the controller is to be anchored. This...