Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

android stop audio playing by activity lifecycle

@Override
    protected void onStop() {
        super.onStop();
        backgroundmusic.pause();
        length = backgroundmusic.getCurrentPosition();  
    }

@Override
    protected void onResume() {
        super.onResume();
        backgroundmusic.seekTo(length);
        backgroundmusic.start();
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #android #stop #audio #playing #activity #lifecycle
ADD COMMENT
Topic
Name
5+3 =