android-input-filter

EditText input filter causing repeating letters

家住魔仙堡 提交于 2020-02-23 11:34:10
问题 I have been limiting the input to my edittext like this; InputFilter filter = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { String output = ""; for (int i = start; i < end; i++) { if (source.charAt(i)!='~'&&source.charAt(i)!='/') { output += source.charAt(i); } } return output; } }; But anyone who has used this method will know that it causes repeating characters when it is mixed with auto correct and the

InputFilter on EditText cause repeating text

匆匆过客 提交于 2020-01-12 12:26:53
问题 I'm trying to implement an EditText that limits input to Capital chars only [A-Z0-9] with digits as well. I started with the InputFilter method from some post.But here I am getting one problem on Samsung Galaxy Tab 2 but not in emulator or Nexus 4. Problem is like this : When I type "A" the text shows as "A" its good Now when I type "B" so text should be "AB" but it gives me "AAB" this looks very Strange. In short it repeats chars Here's the code I'm working with this code : public class

Android: Handle backspace on InputFilter

与世无争的帅哥 提交于 2019-12-23 21:53:22
问题 I created an InputFilter for an EditText component that only allows doubles within a range (e.g. from 1.5 to 5.5). Everything worked fine until I deleted the decimal point: I typed 1.68 and then deleted the decimal point. The value in the text field became 168, which is obviously outside the range. Here is a simplified version of my filter public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { if (isValid(dest.toString() + source.toString()))

How to filter the input of EditText?

前提是你 提交于 2019-12-20 14:43:18
问题 I want to filter the input of an EditText , only digits and letters are allowed, first I use TextWatcher to deal with the last input character, but when you move the cursor or you past some content to the EditText , this method failed, now I want to know is there a way to filter the illegal input and give the user a feedback. 回答1: Add InputFilter to your EditText & provide a Toast for user . This code snippet will help you. InputFilter filter = new InputFilter() { public CharSequence filter

Asus Zenfone (Android) TextView\\TextWatcher keyboard input bug

给你一囗甜甜゛ 提交于 2019-12-06 12:02:19
Update: actually, this is not a problem with Asus Phones, it's a problem with Asus ZenUI's keyboard. You can install a keyboard you like to walk around the problem. I have tested Zenfone 2 with Google Keyboard installed. Everything in my TextWatcher works fine. But it is not a bug fix or problem solution. I have two InputFilter s and one TextWatcher attached to my EditText . InputFilters : standard InputFilter.AllCaps() filter and custom 'alphabet characetrs only'. They works as magic. TextWatcher makes some text transofrmations (transliterates symbols from Russian into English). TextWatcher

Using a TextWatcher on a EditText to calculate the total and sum total in real time in android?

一世执手 提交于 2019-12-06 00:50:43
Here i want to take the default value coming from my database and setText to that value and calculate the net rate and total or else if the user edits the rate or making charges i would like to calculate the net rate and total based on that value in real time. This is my code for calculating and displaying the values. private void showItem(String json) { String itembarcode = ""; String itemdesc = ""; String weight = ""; String rate = ""; String making = ""; double wt = 0.0d; double rt = 0.0d; double mk = 0.0d; try { JSONObject jsonObject = new JSONObject(json); JSONArray result = jsonObject

InputFilter on EditText cause repeating text

99封情书 提交于 2019-12-03 23:28:31
I'm trying to implement an EditText that limits input to Capital chars only [A-Z0-9] with digits as well. I started with the InputFilter method from some post.But here I am getting one problem on Samsung Galaxy Tab 2 but not in emulator or Nexus 4. Problem is like this : When I type "A" the text shows as "A" its good Now when I type "B" so text should be "AB" but it gives me "AAB" this looks very Strange. In short it repeats chars Here's the code I'm working with this code : public class DemoFilter implements InputFilter { public CharSequence filter(CharSequence source, int start, int end,