0

Well this question of mine doesnt relate to any code especially, but what I wanted to ask is that How do I achieve something like

1: Play the music on my application.
2: Then press the home key on the device, whilst the music is been played.
3: Then again long press the home key n regain access to the object that was playing the file, which is a common user expectation, but what my player does is the 4th step.

4: Whilst continuing to play the previous file, it launches a whole new interface of the player , wherein the seekbar is at 0 the play button is in the idle mode. Hence leads to confusion. 
5: N if I touch the play button the player starts playing another file from the start along with the previous one, so now I have 2 files played by my player

How do I avoid this?

Is singleton that is necessary to be applied here? Plz guide me in some manner.

  • Singleton definitely doesn't apply here, and there has to be code since you describe the behavior of your app. How are you playing the media after your Activity closes? A Service? – Dave Sep 18 '13 at 11:44
  • Well I guess I will have to use the shared preferences for this, By Overriding the onPause() method n onResume() method, I think should sort out things a bit! What do you think @Dave? – user2714061 Sep 21 '13 at 02:33
  • If you are simply trying to open the same file and seek to where you left off, then SharedPreferences is one of several solutions that would work. – Dave Sep 23 '13 at 00:30

0 Answers0