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
Post a Comment