Return / Enter not detected on SOME phones

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Return / Enter not detected on SOME phones

Post by KimD » Tue Jul 19, 2016 5:29 am

I recently released a puzzle app on the Google Play Store in New Zealand (my home country) only. To-date I have about 30 downloads.

Two of these 30 dowloads (that I know of) are experiencing a problem with the Return/Enter key not ever being recognised at the end of a data input field. One was a Sony Xperia Android 6.0 phone, and the other was a budget model Samsung running Android 4.0. Very different devices.

I cannot reproduce this problem on either the Android simulator or my two test devices. Additionally, I had 8 beta-testers, and none of them encountered the same problem. On MOST phones it seems to work without any problem.

Any advice on either
- what I've got wrong in my code (shown below); or
- how I can go about identifying the cause of the problem (I don't really want to have to buy budget Samsung phones until I find one that has the same problem)
would be much appreciated.

Thanks in advance

Kim

================================================================================


// Code associated with field EDITUSERNAME

// On the problem phones - the CheckUsername and SaveOnThis Device buttons do not appear after the user presses the Return / Enter button on his phone's keyboard. I've had users test this after entering "test1234" - which should have been a valid entry.


On OpenField
Select after text of field "EditUsername"
Set the visible of button "CheckUsername" to false
Set the visible of button "SaveOnThisDevice" to false
end OpenField

Local kdKey
on keyDown kdKey
if (kdKey is among the characters of "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_") and (the length of me <= 16) then pass keyDown
end keyDown

On returnInField
If (the length of field "EditUsername" >= 6) and (the length of field "EditUsername" <= 16) then
Focus on nothing
Set the visible of button "CheckUsername" to true
Set the visible of button "SaveOnThisDevice" to true
Else
Select after text of field "EditUsername"
End if
end returnInField

On enterInField
If (the length of field "EditUsername" >= 6) and (the length of field "EditUsername" <= 16) then
Focus on nothing
Set the visible of button "CheckUsername" to true
Set the visible of button "SaveOnThisDevice" to true
Else
Select after text of field "EditUsername"
End if
end enterInField

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Return / Enter not detected on SOME phones

Post by MaxV » Tue Jul 26, 2016 5:20 pm

Try with this:

########CODE#######
// Code associated with field EDITUSERNAME

// On the problem phones - the CheckUsername and SaveOnThis Device buttons do not appear after the user presses the Return / Enter button on his phone's keyboard. I've had users test this after entering "test1234" - which should have been a valid entry.

On OpenField
Select after text of field "EditUsername"
Set the visible of button "CheckUsername" to false
Set the visible of button "SaveOnThisDevice" to false
end OpenField

#Local kdKey #Why?
on keyDown kdKey
if (kdKey is among the characters of "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_") and (the length of the text of me <= 16) then pass keyDown
end keyDown

On returnInField
myCheck
end returnInField

On enterInField
myCheck
end enterInField

on myCheck
If (the length of field "EditUsername" >= 6) and (the length of field "EditUsername" <= 16) then
Focus on nothing
Set the visible of button "CheckUsername" to true
Set the visible of button "SaveOnThisDevice" to true
Else
answer "Username not valid"
Select after text of field "EditUsername"
End if
end myCheck
#####END OF CODE#####

Now users will notice an error when choosing the username. Otherwise use native mobile field.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Return / Enter not detected on SOME phones

Post by KimD » Thu Jul 28, 2016 8:52 pm

Thanks Max

Unfortunately I have no way of testing your alternative as my original code worked fine on all of my test devices.

My current (unconfirmed) thinking is that the most likely cause of the problem that approx 10% of users were encountering was OTHER apps redefining their phones keyboards (e.g. changing the Return key into a Send key). But I didn't want to spend days investigating this so I implemented a quick work around by adding an on-screen Return button to my app - so it now doesn't matter whether the Return button on the users phone's keyboard works or not.

Regards

Kim

Post Reply

Return to “Android Deployment”