i've made own keyboard shown user. i've found how play sounds while pressing key if press 1 , inmediatly another, plays first sound. there way making sound played each time press key if there's 0,1 millisecond between them? here code:
final mediaplayer mp = mediaplayer.create(this, r.raw.sn_tecla); final mediaplayer mpspc = mediaplayer.create(this, r.raw.sn_spc); texto1.settypeface(fuente); //this each key. btn1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { mp.start(); texto1.settext(texto1.gettext() + "1"); } });
thank in advance.
use soundpool http://developer.android.com/reference/android/media/soundpool.html
soundpool sp = new soundpool(5, audiomanager.stream_music, 0); /** soundid later handling of sound pool **/ int soundid = sp.load(context, r.raw.windows_8_notify, 1); // in 2nd param u have pass desire ringtone sp.play(soundid, 1, 1, 0, 0, 1);
Comments
Post a Comment