444 CHAPTER 11: Digital Video: Streaming Video, MediaPlayer, and MediaController classes
Figure 11-37. Declare a MediaController named videoTransport, and construct a new MediaController( ) object
Figure 11-38. Wire videoTransport to videoPlayer using the .setAnchorView( ) and .setMediaController( ) methods
- Once you declare the MediaController videoTransport; statement at the
very top of your PlayVideo Activity subclass, and mouse-over and Import
MediaController (android.media), you will be able to instantiate and
construct your new MediaController object inside of your onCreate( ) method.
Notice in both Figures 11-37 and 11-38 that I’ve clicked on the videoTransport MediaController
object in the Java code, which tells Eclipse to highlight the (tan colored) tracking of the instantiation.
I did this in the next screenshot to show both the videoTransport MediaController object
declaration and instantiation (tan color) as well as the object use (gray color) for the videoTransport
MediaController object. This is a simple but effective technique to track an object’s usage throughout
your Java programming logic.