android - i'm building an application for blind people so i need to read button input -


i building application blind people. need read button input, before read, want play audio button content. when finger on top of button need play audio, i.e word given button.

how can it?

        @override        protected void oncreate(bundle savedinstancestate) {          super.oncreate(savedinstancestate);          setcontentview(r.layout.activity_main);           getsupportactionbar().hide();// code hide applicatoin name           getwindow().setflags(windowmanager.layoutparams.flag_fullscreen,windowmanager.layoutparams.flag_fullscreen);     //to hide notification bar          button speakbutton = (button) findviewbyid(r.id.bt1);         speakbutton.setonkeylistener(this);          tts = new texttospeech(this, this);      } 

you can add touch listener check type of event see if action_down or action_up event.

speakbutton.setontouchlistener(new ontouchlistener() {     @override     public boolean ontouch(view v, motionevent event) {        if (event.getaction() == android.view.motionevent.action_down) {            //play sound        } else if (event.getaction() == android.view.motionevent.action_up) {           //do action        }         return true;    } }); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -