Copying Media Player Object
If I create a copy of a MediaPlayer object, which object will a callback function be 开发者_如何转开发called on. For example:
MediaPlayer mp = new MediaPlayer();
MediaPlayer mp_copy = mp;
mp.setOnBufferingUpdateListener(...);
mp_copy.setOnBufferingUpdateListener(...);
When the buffer is updated, which object will receive the callback (or will both of them)?
Thanks.
When you do this:
MediaPlayer mp_copy = mp;
you are not making a copy of a MediaPlayer object. You are making a new reference to the same object. The second call to setOnBufferingUpdateListener
will undo the effect of the first call.
精彩评论