Having an issue with my app when trying to run it on an Acer Iconia One 10 tablet that is loaded with Marshmallow 6.0. This app works perfectly on a Samsung Galaxy Tablet running Android 4.2.2.
The main view consists of a series of TextViews and EditTexts where the user can enter information. The fields need to be able to accept either text or numerals. I use the field android:inputType="textCapSentences" to accomplish this. It has always worked. However, with 6.0, I'm getting a weird behavior that I believe has to be some type of version issue. If I type in letters everything is fine. But when I try to enter a string like "Route 169", the numbers will not appear. If I type in "Route169" it puts the numbers up there. It seems that once I put in a , the EditText stops accepting input. I have tried every variation of android:input="someInputType" that could possibly work for me and nothing has fixed it. I also tried the android:digits="ABC....0123 " solution.
Here is my EditText definition:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/highwayNameEditText"
android:text="*****"
android:inputType="textCapSentences"
android:layout_below="#+id/highwayNameTextView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/highwayNameTextView"
android:layout_alignEnd="#+id/highwayNameTextView" />
It is within a ScrollView using a RelativeLayout. I have also tried adding a key event listener to no avail.
Logcat shows the following messages when the keyboard character is successfully transfered to the EditText:
D/OpenGLRenderer: CacheTexture 4 upload: x, y, width height = 0, 261, 15, 19
When the entry fails, the following appears in logcat:
View Root Impl: **[ANR Warning]Input routeing takes more than 6000ms**
Input event delivered to android.view.View Root Impl$Early PostImeInputStage
Input event delivered to android.view.View RootImpl$Native PostImeInputStage
Input event delivered to android.view.View Root Impl$ View PostImeInputStage
Input event delivered to android.view.View Root Impl$ Synthetic InputStage
The sequence repeats.
Note: I have removed time, date, and location information from the output to make it more readable.
As you can see, the system saw a key press event. The character did not make it to the Edit Text string. There also appears to possibly be a timeout issue of some kind. Thank you for taking the time to read this.
Related
I have created a simple kivy app which is successfully running on windows. It takes barcode of products as input and proceed further. I have designed my own keypad for my application + It takes input from Barcode Scanner as well (Scanned barcode is being placed in focused TextInput). For this, I have set
Config.set('kivy', 'keyboard_mode', 'system')
which works perfectly fine.
Now, I want to run this app on android. On android, when a TextInput get's focus the android's keyboard becomes visible, which I don't want. I set TextInput property 'keyboard_mode' to 'managed' for this but it stops putting scanned barcode (from Barcode Scanner) in TextInput (as system keyboard will not be requested now).
What I want, hide the keyboard but it remain binded with focused TextInput, to access input from Barcode Scanner. I am stuck here, any help will be highly appreciated.
I am using: kivy==2.0.0, python==3.7.9 and buildozer to package application for android.
I have a few ideas but I first want to double check that you've put the Config.set('kivy', 'keyboard_mode', 'system') statement in the right place.
This needs to come before everything, i.e. the first two lines of your your main.py file should look like this:
from kivy.config import Config
Config.set('kivy', 'keyboard_mode', 'system')
from kivy.app import App
from kivy.core.window import Window
# etc.
The reason I ask this, is because writing Config.set() after importing App has no effect. On your computer I believe the default keyboard_mode is '' which is to simply choose the best option, which coincidentally is system. This can give the illusion of a working Config.set().
I have a text view that contains an email and a phone number. My desired effect is that when the user taps the email, it opens the default emailing application and when the user taps the phone number, the application pulls it up in the dialer. With the code below:
XML:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/careers_guidance"
android:id="#+id/careers_guidance_text"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="5dp"
android:linksClickable="true"
android:textColorLink="#0000EE"
android:autoLink="all"/>
Java:
careersGuidance = view.findViewById(R.id.careers_guidance_text);
careersGuidance.setText(Html.fromHtml("<p>Help with choosing the right course and with thinking about where this might take you in the future.</p>" +
"<p>Tel: 01274 433043</p>Email: careers#bradfordcollege.ac.uk"));
When I run my application, only the email is clickable and works the way I want it to work, the phone number isn't clickable or highlighted.
However, I have noticed that if I remove the email address from the setText java code, and run the application. The phone number becomes blue and underlined as if it is clickable, but when I tap it, nothing happens.
How can I get this working?
Also, I have CALL_PHONE permissions granted in my manifest file, and also on my emulator device.
From the email (.ac.uk), I suppose that you are from UK. You just need to add your country phone number prefix to replace 0, which is +44. And you don't need to use Html.fromHtml.
careersGuidance.setText("Help with choosing the right course and with thinking about where this might take you in the future.\n\nTel: +441274433043\n\nEmail: careers#bradfordcollege.ac.uk");
In your xml, you just need this property
android:autoLink="all"
You have to add your country code into Tel no.
Like this :
careers_guidance_text.setText(Html.fromHtml("
<p>Help with choosing the right course and with thinking about where this might take you in the future.</p>"
+"<p>Tel: +441274 433043</p>
Email: <a href=\"mailto:careers#bradfordcollege.ac.uk\">
careers#bradfordcollege.ac.uk</a>"));
Also have to add CALL PHONE Permission in android manifest file.
uses-permission android:name="android.permission.CALL_PHONE".
I am getting this weird behavior. The weirdest part is that it's happening randomly. Here is a description of what happens :
I have a React App, with a controlled input, focus is done on this input when component is shown. Sometimes, on Android in Chrome (was not able to reproduce it in Firefox), when page is loaded keyboard opened (following the focus on the input) but when I type, nothing happens. Leaving/reopening the keyboard does not change a thing, but leaving the tab and coming back on it makes everything working.
I monitored events from devtools on document and it appears that when it's not working I only get these events :
keydown (KeyboardEvent)
keyup (KeyboardEvent)
While when it's working, I get these ones :
keydown (KeyboardEvent)
input (InputEvent)
keyup (KeyboardEvent)
So the input event is missing. Does anyone have an idea about what can lead to the input event not to be produced ??
I am hardly able to give a reproducible code since it's inside a massive project. But the input is rendered inside a React component with the following code :
<input
value={this.props.query}
onChange={this.onQueryChange}
ref={focus}
placeholder='Type your search here'
/>
Focus is focusing on the input on rendering (removing it does NOT remove the bug) :
const focus = input => {
if (input) {
const hasFocus = input === document.activeElement
input.focus()
if (!hasFocus) {
input.select()
}
}
}
Any clue is welcome... Thanks.
I figured out myself where the problem is coming from. I am posting the answer if it can help someone else...
This problem comes from a bug in Chrome (< 61 it seems), that occurred when there is a basic-auth in front of the website. More information about this bug can be found here : https://bugs.chromium.org/p/chromium/issues/detail?id=740652
I was not able to reproduce the bug locally (I do not have basic-auth enable locally), but once I enabled it, the bug appeared.
Since I have basic-auth only in my staging env, I do not need to find a workaround for this. But there are some clues described in the bug ticket if needed...
I create an EditText programmatically using these lines of code:
ContextThemeWrapper mContextThemeWrapper = new ContextThemeWrapper(context, R.style.AppTheme);
EditText mEditText = new EditText(mContextThemeWrapper);
mEditText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
The keyboard that shows when I focus on the input is the following:
However, I am unable to select the "-" sign. I've tried pressing once, twice, holding, and the button always inputs a ".".
Any ideas on how to input the minus sign before my negative number?
Edit 1
Apparently the problem is with the device I need to use. I'm using a Samsung Tablet E with Android 4.4.4.
Testing the same EditText on a different device worked as expected, but I need to run on the tablet.
It seems that the code you are using is correct and the proof to that is that everything is working fine on other devices. Because the problem is only on one device you are testing on the problem seems to be not on the app or code, but on the device itself.
Solution: Try resetting keyboard settings or cleaning the cache/memory of keyboard app to restore the factory defaults.
I'm using Cordova 3.6.4 in Visual Studio 2013 Community Update 4 to build an apps with a "chat" functionality, the main reason that I use this technology is because I want to, hopefully, write once and can use it in all platforms such as Android phones, iPhones, all mobile phone browsers, all desktop browsers.
In order to let the users inputting the "message" to be sent, I create a [div] which is contenteditable="true" at the bottom left of the html, at the right hand side of this [div], I have two [image buttons], one is the [happy face] button, the other is the [send button]. (You know, just like Whatsapp, Line and WeChat!)
At any time the user can click the [happy face] button to select one of the many "face image" to insert into the cursor at the [div], then I'll add the html codes into the [div], e.g. div.innerHTML += '< img src="1.jpg">'
So, the innerHTML of this [div] can contain characters AND images, e.g.
12< img src="1.jpg" />34< img src="2.jpg" />
Of course, the actual display is:
12[1st Picture]34[2nd Picture]
If the cursor is at the end of this [div], and I clicked the [BACKSPACE], I expect the [2nd Picture] will be removed, if I clicked the [BACKSPACE] again, I expect the letter [4] will be removed from the [div], this is work at ALMOST every platform I mentioned including all mobile browsers in android and iphone/ipad, all desktop browsers. But it does not work when I build an Android app and run it in any Android phone.
Running it as a WebView in android phone, when I click the the [BACKSPACE], the letter [4] is removed instead of the [2nd Picture], when I click the [BACKSPACE] again, the letter[3] is removed. I can NEVER remove the 2 images no matter which IME I'm using.
To work around, I tried to add a keyup/keydown/keypress listener to the [BACKSPACE] but it never fires.
At last, to work around this [BUG], I need to add a third [X] image button and use JavaScript string.replace to remove the < img> tag when users click this [X] button, but it looks very stupid to the users!
It makes me crazy that ALL IMEs do not remove the image for me by pressing the [BACKSPACE], and if the key events are not fired, I cannot remove the images myself!
I tried ALMOST, I think, ALL the suggestions provided by stackoverflow but they don't work at all, either not applicable to CORDOVA, or with compilation error such as [command failed with exit code 8] in Visual Studio.
What should I do?