I want to create a MediaPlayer inside my Fragment but I don't want to specify the Uri when at the time I create a player. When I try to use the default constructor (new Mediaplayer()
) it doesn't work within a Fragment (only within the Activity) and using Mediaplayer.create()
can't be called with just the Context and without an Uri.
Of course, I could create the MediaPlayer inside my main activity and then pass it into the Fragment but that seems a bit dirty. Is there a clean way for me to create my MediaPlayer?