nikhil bansal
nikhil bansal

Reputation: 451

Hide/ Disable mic option from android soft keyboard

I want to hide the mic from soft keyboard in my current application.

I have tried these possible solutions for the same.

Disable speech to text button (Micro phone) on soft input keyboard in android programmatically

But this solution is not working at all.

I found one unexpected thing, when add the inputType = “textFilter” then it works for me, I mean the mic is getting hidden.

But If possible then I want to have the exact solution for the problem, because If I adopt the mentioned “textFilter” thing then later times it may break.

I have tried on below O.S. versions

  1. Pie(API-28), Device - Pixel2XL
  2. Marshmallow(API-23), Device - MotoE3Power

Upvotes: 0

Views: 902

Answers (1)

Ali Azaz Alam
Ali Azaz Alam

Reputation: 1868

You can also define android:privateImeOptions="nm" in XML where nm = [no microphone]:

<AutoCompleteTextView
                        android:id="@+id/email"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:privateImeOptions="nm" />

Upvotes: 1

Related Questions