Andreas Konstantakos Andreas Konstantakos - 5 months ago 9x
Java Question

Play sound when typing in EditText in android application

Hi i am making an android application.
I want to play a default sound effect when i am typing in an EditText field.
Any ideas how to do that?



you can use textwatcher for that purpose

 youredittext.addTextChangedListener(new TextWatcher() {
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {


            public void onTextChanged(CharSequence s, int start, int before, int count) {


            public void afterTextChanged(Editable s) {
          MediaPlayer mp = MediaPlayer.create(this, R.raw.yourmp3); // add mp3 file 

Note : add yourmp3 in res->raw folder