views:

79

answers:

3

Is there any way to get the details of current song played by mediaplayer?

+2  A: 

There is no documented method for getting info on the currently playing file from a MediaPlayer instance, you'll need to make your app store that information itself in another way. If you're using a Service to keep track of your MediaPlayer instance (which I'd recommend) then this shouldn't be too hard.

fredley
Hi Fredley, Thank you for your suggestion.
Eby
I can see lot of widget which shows the song details like you see in http://developer.android.com/guide/topics/appwidgets/index.html this widget.
Eby
Yes. And? Music widgets are designed to integrate with a certain player, and you can't make your own widget easily integrate with another media player.
fredley
OK... Then i ll create a service to keep track on Media player instance..Thank you very much for your suggestions
Eby
A: 

I think you need to have your own model classes from wherein you can set and get your song title and other info

http://stackoverflow.com/questions/2780295/how-to-set-the-playlist-index-for-mediaplayerexpressionmediaplayermediaplayer

If you are keen to know how it is being implemented you can get the source from here and see how they have implemented it

http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=snapshot;h=a85323ea0e3877e33820b86a7dea696d32c7a034;sf=tgz

Rahul
A: 

I found a solution here

Eby