android - How to play a button sound while playing a background music? -
i want know how play button's sound while background music playing? , also, want know how continuously play background music other activities. please me.
this code of firstactivity.java
public class firstactivity extends activity { mediaplayer bgsound,menuselect, settingsselect; bgsound.start();mediaplayer bgsound,menuselect, settingsselect; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.activity_first); bgsound = mediaplayer.create(firstactivity.this, r.raw.theme); bgsound.setlooping(true); bgsound.start(); final imageview btnplay = (imageview) findviewbyid(r.id.imgplay); final imageview btncredits = (imageview) findviewbyid(r.id.btncredits); final imageview btnscores = (imageview) findviewbyid(r.id.btnscores); final imageview btnsettings = (imageview) findviewbyid(r.id.btnsettings); btnplay.setonclicklistener(new onclicklistener(){ public void onclick(view v) { bgsound = mediaplayer.create(firstactivity.this, r.raw.menu_select); menuselect.setlooping(true); menuselect.start(); animationset set = new animationset(true); animation animation = new translateanimation( animation.relative_to_self,1, animation.relative_to_self,1); animation.setduration(5); set.addanimation(animation); btnplay.startanimation(animation); intent i=new intent( firstactivity.this, secondactivity.class); startactivity(i); } });
Comments
Post a Comment