I\'m new to Android, so I have a problem. In Android I want to play background music as soon as my music player starts and have it continue even if the activity changes from
try this
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK ) { music.stop(); return true; } return super.onKeyDown(keyCode, event); }
else if you have any separate button action for closing the app, there to u can call as music.stop();