Search code examples
javaandroidandroid-edittextvoice

How i replace voice to each edittext


You see the 2 edittext so I think that when the cursor available on EditText I will make content in that EditText so how can implement this.

see image below.

enter image description here


Solution

  • Simplest way would be TextWatcher Listeners which will trigger when you click on edittext.

    editText.addTextChangedListener(new TextWatcher() {  
    
            @Override  
            public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {  
    
            }  
    
            @Override  
            public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {  
                //enable your speech to text.
            }  
    
            @Override  
            public void afterTextChanged(Editable arg0) {  
    
            }  
        });  
    

    Tell me what you think.