Kiran S
Kiran S

Reputation: 178

Issue with android softkeyboard when typing onto texarea inside webview

i have designed a chat app with android webview which has a textarea and a button.The purpose of button is to send the input text like u see in whatsapp.The problem with my app is that when i click on the send button or outside the textarea, anywhere on webview the soft-keyboard automatically hides quickly and it reappears only if i click inside the textarea again.I have tried many solutions still no luck.my goal is to prevent the soft-keyboard from hiding on whatever events occuring on webview.pls suggest a solution

Upvotes: 0

Views: 334

Answers (1)

Kiran S
Kiran S

Reputation: 178

I have found the solution myself.I am posting it here so that it may help anyone in the future.This is the html code that caused problem in android webview

 <div class="chat-input">

      <input type="textarea" class="form-control" id="message">
      <button type="button" class="btn" id="send">Basic</button>

    </div>

The problem i encountered was when the send button is pressed,the soft-keyboard dismisses itself.i think this is because of textarea loses its focus.The solution is to call focus method on textarea.like this

$("#send).click(function(){
    $("#message").focus() ;
    sendmessage();
})

Upvotes: 1

Related Questions