EditText and MultiAutoCompleteTextView suggestions - android

I'm using a MultiAutoCompleteTextView in my app to show various suggestions.
I noticed that MultiAutoCompleteTextView doesn't support the regular android suggerstion that come defaultly with an EditText (the strip of suggestions that pops above the soft keyboard.
Is there a way of showing both the regular suggestions, and the ones I want to show in my MultiAutoCompleteTextView?

I found that setting the input types only took effect when I set them with setRawInputType(). I also found out that the only way to use InputType.TYPE_TEXT_FLAG_AUTO_CORRECT was to include
include InputType.TYPE_CLASS_TEXT also. So it would result in something like this:
multiAutoCompleteTextView.setRawInputType(InputType.TYPE_CLASS_TEXT
|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
|InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
|InputType.TYPE_TEXT_FLAG_MULTI_LINE);

Related

AutoFill EditText Android

I'm trying to create a search bar like.
I have to use a particular autofill, infact I can't use a dropdowns menu.
For example if I write Noce the edittext will have to suggest Nocera in the same editText, like this.
but if the user write something else the pointer have to the end of the typed text (in this case Noce) and the hint have to disappear.
Is there some library that allows me this?
Thanks for the help.
There's this library that will fulfill some of your requirement called Auto Fill EditText
Finally I have solved this using two EditText in the same position. The first one is a normal editable EditText, the second one is not editable from the user but is used to show the hints programmatically.

How to open Android keyboard show only custom digits in Android

I want to show digits "0123456789/" on keyboard if open on click of SearchViewbut I don't know how it can be done. I am able to set InputType to a searchview like this
searchView.setInputType(InputType.TYPE_CLASS_NUMBER);
but not able to set custom digit to show on a keyboard.
from input type InputType.TYPE_CLASS_NUMBER numeric keyboard is opening but i also want to show "/" also with numeric digits 0123456789.
I searched a lot on SO but didn't find any solution for this.
There is no easy solution for this. You have two options depending on what you can work with and what exactly you want.
If it is exactly as you say in your question, that is, to SHOW
just the Characters that you specify, then the way to go about doing
that would be to create a Custom SoftKeyboard. This will allow you
to take only the desired inputs and will show only those characters
that you have specified.
Otherwise you can disable taking other
characters input (that are not to be available), by working with
[onQueryTextChanged]1 where you manipulate to resend only the
values that you can take in as input. Here the default
softKeyboard is used, but the input taken in by the SearchView are
as per specification.
Note : my knowledge is mainly based on working with EditText rather than SearchView, so not able to provide exact codes for the above

How to remove Android auto-suggest underlining in EditText?

I'm using an EditText to write some text. Android's auto-suggest underlines the word, until we hit space. Now, if I enter the word without the space, the resulting text has an underline. It's because I use Html.toHtml(view.getText()).
Now, there are a few answers I'll be expecting such as disabling auto-suggestion or using view.getText().toString(), but I need them both. I need the auto-suggestion feature as well as the formatting of the text. An example which solves this problem is the Gmail app. You can write whatever you want in the EditText box and it sends the email without the words being underlined.
Use this just before you getText(). This is the most straightforward and the official way.
edittext.clearComposingText();
Do it like this
android:inputType="text|textNoSuggestions"
I just came up with a solution for this. After submitting the text, just hide the keyboard, and the text underline goes away.

Set EditText to be Multiline(Enter is carrige return) and not display suggestions

I am trying to set a Android EditText to be Multiline, and not display any suggestions.
textView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
However, this is just a single line. Currently pressing the enter/carriage return button hides the keyboard, instead of moving to a new line.
textView.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
Setting the IME flag causes the enter button to insert whitespace.
I need to display no suggestions and also have the EditText to be multiline. Am I missing something here?
I have solved this issue. I was using SwiftKey keyboard, swapping to the default Google keyboard seems to work perfectly. My guess is swiftkey doesn't have some of these methods implemented?

How to enter special characters in an EditText in Android?

Is there any way to input special characters (which are not present in the default soft keyboard ,eg. theta) in an Android EditText?
Thanks..
Well as per your need, I would like to suggest to create a custom keyboard because the stock keyboard which comes with the device may not have the special characters you need.
You can refer the following tutorial to create a custom keyboard
http://www.fampennings.nl/maarten/android/09keyboard/index.htm
or you can see this search result which may serve your purpose,
https://github.com/search?q=android+custom+keyboard&ref=cmdform
And from below site you can get the list of Unicode characters which Android supports,
http://en.wikipedia.org/wiki/List_of_Unicode_characters
http://unicode-table.com/en/#0026
Note: Writing the whole code to create a custom keyboard is beyond the scope of this answer, so I mentioned the reference link.
What you are going to do is to create a custom keyboard. First thing you want is to hide the default keyboard when an EditText is focused:
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Now, you must create a custom layout (RelativeLayout or Multiple LinearLayouts this is your desire), create and set text to the buttons that you want to show. Make this keyboard view setVisibility(View.INVISIBLE) or setVisibility(View.GONE), and whenever your EditText is focused, make it setVisibility(View.VISIBLE).
After keyboard is visible, programming the rest is up to you it is practically easy.
If you also need a guide, here is an example.

Categories

Resources