Fix misspelled words on Android EditText - android

How can I implement an EditText that automatically fixes misspelled words when taping soft keyboard spacebar? I have seen this behavior on Whatsapp, for example if you write "aricle" and press spacebar it puts "article", same if you write "articl" or something like that, is that an Android behavior or a Whatsapp specialized behavior? I have tried with AutoCompleteTextView and setting autoText=true (although is deprecated I had to try)

Autocorrect is a feature of the keyboard that you use. But if you want to put this feature in your android application then you can use spelling checker framework offered by anroid. It lets you implement spelling checker in your android application with the help of android service.
For more details you can see below link
https://developer.android.com/guide/topics/text/spell-checker-framework.html#SpellCheckLifeCycle
And for example you can look into this link
https://code.tutsplus.com/tutorials/an-introduction-to-androids-spelling-checker-framework--cms-23754

Related

Is it possible for an app to prevent the keyboard from learning words on Android?

I am developing an Android application (Xamarin Forms) where the user will be entering personal and potentially sensitive information. I would like to prevent the keyboard from "learning" words that the user enters into the application.
I know it is possible for the user to manually delete learned words from their phone (as explained here: https://trendblog.net/delete-learned-words-android-keyboard/ ) but is it possible for an application, or specifically text entries, to tell Android to not learn from entered text?
In Xamarin Forms Entry, try turning off text prediction:
<Entry ... IsTextPredictionEnabled="false" />
I don't know whether that also disables "remembering" what you type. Try it, and leave a comment whether that worked.
If no cross-platform solution is suggested, then you'll need to make a "custom renderer" for Entry, in your .Android project.
There, behavior is controlled by the input type.
Try visible password or maybe no suggestions. (not sure exactly what those are in xamarin, but intellisense will show you the options, at the right place in the custom renderer's code.)

New Android keyboard behaving unexpectedly in certain apps

I am a linguist, not a programmer, sorry. I was asked and am adapting a keyboard for a minority language in Africa. I have spent a lot of time on this and am willing to learn more and to dig deeper.
I am using the latest Android Studio in Windows 10 and am working from a code sample from Google here:
https://android.googlesource.com/platform/development/+/master/samples/SoftKeyboard?autodive=0%2F
I managed to adapt this sample to our local language and compile and install in a several different phones from our team and all the new characters in the alphabet are working fine (ǝƎ ŋŊ ɖƉ ɔƆ ɛƐ ɩƖ ʊƱ). No problems here, this is just background for those who like that.
The unexpected behaviour is sadly with several existing keys, which I have not altered: apostrophe, quotation marks, hyphen, etc. Those are characters which to me "are too active"; possibly an escaping-problem or something the like.
When using my new keyboard in WhatsApp I can type any text just fine, until I need (for example) an apostrophe. Then the apostrophe will delete any alphabet-letter backwards until it hits a "resisting character" (those are space, full stop, comma and some others) and then it will show itself. Example sentence: "Three pigs' house."
I am typing this:
Three pigs
then I hit apostrophe and am expecting this:
Three pigs'
but instead I get this:
Three '
You can see how the apostrophe has deleted "pigs" and has been stopped by the space behind "Three". The same happens for - and for " and for a few other "bad keys".
I have this unwanted behaviour in several "powerful apps" like WhatsApp and Telegram but NOT in a simple text editor like this one:
https://play.google.com/store/apps/details?id=com.maxistar.textpad
I double-checked and compiled the original sample keyboard: It shows the same bad behaviour in WhatsApp, Telegram etc. but not in Simple Text Editor.
So the Google sample SoftKeyboard is having issues. I quote their doc:
Example of writing an input method for a soft keyboard. This code is
focused on simplicity over completeness, so it should in no way be considered
to be a complete soft keyboard implementation. Its purpose is to provide
a basic example for how you would get started writing an input method, to
be fleshed out as appropriate.
I would like help please:
Is this really a problem with the keyboard, or is the fault with WhatsApp etc. for "doing too much" with the characters being sent by the keyboard?
Or how can I find out where the deleting is happening? (Since this is only an input method, the Android Studio's debugging tools do not yet work for me.)
Is there a forum, where I can get help for that specific SoftKeyboard?
Any input to help me to change my self-made keyboard so that it behaves normally in any App which needs text-input, even WhatsApp, Telegram and the like.
Or is there another working template out there, which I could use to make a working soft keyboard for our language. Since I am not a pro, I am hoping for something that I can import into Android Studio for adapting.
Please do not yell at me. Any input and any help is welcome. I can upload my files, but the behaviour can be observed from the original SoftKeyboard files (see my first link at top). If you can type your own language, please be grateful. My people would also love to write their language in WhatsApp. Thank you.
First update:
I have looked over the main Keybaord.java file and have changed
mPredictionOn = true;
to
mPredictionOn = false;
for
case InputType.TYPE_CLASS_TEXT:
This has helped to calm the unexpected behaviour but has also lost some of the functionality. And the caps state is no longer auto-undoing like it is meant to be after user hits one capital letter.

Custom Keyboard like Gboard for Android

I'm looking for references to do a keyboard app like Gboard.
I checked GitHub and googled for custom keyboard for android code and I still don't know what to do.
I came across AnySoftKeyboard but it seems complicated and I think it's not what I'm looking for.
I don't need the keyboard to be that customised, I want to have a search functionality when a user clicked on a key from the keyboard, it will show an input field where the user can type any text and automatically search on the internet about the typedText and display the searches then user can share it as part of the text he/she will send to the recipient.
Creating an Input Method Editor from the Android Docs

Android use smileys keyboard

I am working on an Android chatting application. I need to show, a smileys or emoji's keyboard, like that of 'Whats App'. Is there any such default keyboard for Android? If yes, how do I implement it?
This largely depends on what the user currently has installed. I use SwiftKey on my phone so I have the ability to use the Emoji's. If you are willing to put in the effort to create your own Emoji keyboard then toobsco42 has a great basic explanation of the process as well as a link to a repo that you can use.
i would say start by getting the font with all the unicode charset for your application and render them in an layout invoked on the button in your input field.
One of the website to create custom fonts : icomoon.io

Access Android spell check lists

I would like to access the word lists used on android phones for spell checking (not including the user-defined-dictionary).
I am writing an app which i would like to be able to check if a word exists in the current phone users language. I imagine their is some API call or service i can use to access the build in word lists?
Any help would be great, thanks!
From what i know, each IME has its own dictionary and they probably implement their own method of reading from it. I have multiple keyboards installed on my phone, and if I add a word to the standard android keyboard, it still shows up as a miss-spelling if I switch to another keyboard.

Categories

Resources