Android audio player activity -
i have music player app created, while im playing music , exit app pressing home or button , launch app again, doesn't return current state exit app , song index goes default value 1 music still playing. , when play music again, current song played still playing. therefore, there 2 songs playing. how can save current state of application?
you can save states in onpause() , can retrieve them in onresume()
or can use onwindowfocuschanged() :
public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); if(hasfocus) //retrive state else //save state }
Comments
Post a Comment