KeyboardView
has been deprecated official by android team in API level 29 and i didn't able to find the alternative way for this. Please let me know if there any alternative?
Asked
Active
Viewed 8,340 times
27

Suraj Bahadur
- 3,730
- 3
- 27
- 55
-
3Any update? This seems to be the only question addressing this... – J-Cake Apr 15 '20 at 09:29
-
3https://github.com/hijamoya/KeyboardView, you can try my library, I just do the copy. – Jam Dec 18 '20 at 02:01
1 Answers
10
The only solution Google suggests is copying KeyboardView.java and Keyboard.java files to your local project from Android AOSP. With some customization I managed to make it work as old deprecated KeyboardView
and Keyboard
Android's classes.
You will also have your local copy of com.android.internal.R attributes (stylable) from from here
You can notice, it is annotated as
<!-- {@deprecated Copy this definition into your own application project.} -->
Google:
This class was deprecated in API level 29. This class is deprecated because this is just a convenient UI widget class that application developers can re-implement on top of existing public APIs. If you have already depended on this class, consider copying the implementation from AOSP into your project or re-implementing a similar widget by yourselves

Misha Akopov
- 12,241
- 27
- 68
- 82
-
1Keyboard.java has **deprecated** annotation -.- this is the correct [link](https://android.googlesource.com/platform/frameworks/base.git/+/b798689749c64baba81f02e10cf2157c747d6b46/core/java/android/inputmethodservice/Keyboard.java) – isthemartin Sep 02 '20 at 15:46
-
1@isthemartin Yes, and as I stated in my answer, you should copy the deprecated class and make minor changes. One of such change is remove the deprecated annotation. The class itself works well. It is what Google suggests – Misha Akopov Sep 02 '20 at 16:04
-
2is right, so I have one more question: what happen with **com.android.internal.R** ? it seems that cannot be found on my project – isthemartin Sep 02 '20 at 16:07
-
@isthemartin You also need to copy it from Android Open Source. See my updated answer – Misha Akopov Sep 02 '20 at 16:19
-
1By following your answer, I'm facing an error as "Error inflating class com.android.urdu.KeyboardView". Why I'm getting this error? – Nabeel Ahmed Feb 17 '21 at 07:57
-
1please take a look here https://stackoverflow.com/q/66239268/12050970. I'm facing this issue. – Nabeel Ahmed Feb 17 '21 at 09:47
-
-
Thank you! Could you please tell where to find com.android.internal.R.id.keyboardView and com.android.internal.R.id.button_close? – Svetlana Rozhkova Feb 11 '22 at 14:47
-
1How can we keep recyclerview as the keyboard view instead of the keypad, do anyone aware of that ? – Aan Jul 06 '22 at 16:11