Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5483] KEYPRESSED does not work on Android Devices

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionInvalid
Resolution Date2018-01-05T20:31:15.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid
ReporterAndreas Pingas
AssigneeShak Hossain
Created2018-01-02T14:51:17.000+0000
Updated2018-01-08T15:55:08.000+0000

Description

Hello, keypressed in TextField does not work on all the Android devices. Also, from 7.0.1 titanioum sdk does not work at all. Please check. Thank you in advance. Best, Andreas

Comments

  1. Mostafizur Rahman 2018-01-03

    Hello [~andreas.pingas], Thanks for sharing with us. It would be better if you can provide a sample project to reproduce the issue on our end. Also share your environment details . Best
  2. Andreas Pingas 2018-01-03

    var win = Titanium.UI.createWindow(); var phoneNumberText = Titanium.UI.createTextField({ height:'60dip', top:'0dip', left:'10dip', right:'10dip', hintText:'Phone Number', textAlign:Titanium.UI.TEXT_ALIGNMENT_LEFT, verticalAlign:Titanium.UI.TEXT_VERTICAL_ALIGNMENT_CENTER, color:'#ED4030', borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, keyboardType:Titanium.UI.KEYBOARD_TYPE_PHONE_PAD, focusable:true }); win.add(phoneNumberText); function isValid(e) { } phoneNumberText.addEventListener('keypressed', function(e) { Ti.API.info('keypressed'); isValid(); }); win.open();
  3. Sharif AbuDarda 2018-01-03

    Hello, To my understanding this event only fired when a hardware key is pressed. Not pressing soft keyboard in the display. See docs: "A keypressed event is generated by pressing a hardware key. On Android, this event can only be fired when the property focusable is set to true." Thanks.
  4. Andreas Pingas 2018-01-08

    In titanium sdk 6.3.0 worked properly whereas in titanium sdk 7.0.1, by changing the sdk in some devices works and in some others does not. However, even in 6.3.0 it was not always working properly as sometimes works and sometimes does not. As a result i have replaced it with : var myValue = ''; phoneNumberText.addEventListener('change', function(e) { Ti.API.info('change'); if (e.value != myValue) { myValue = e.value; isValid(); } }); You need to make a change to prevent infinity loop

JSON Source