onkeydown

Calling javascript functions in a webview from activity class [closed]

让人想犯罪 __ 提交于 2019-12-12 08:50:53
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Edit: This snipped worked in the end. I had been trying this before but was actually experiencing a scoping issue with my javascript. I had appBack() defined in document.onready. Simply re-scoping that function

Which interface is used to detect key events from the Dialog class (Android SDK)?

淺唱寂寞╮ 提交于 2019-12-12 05:14:05
问题 I've created a simple custom dialog that asks users to "Press a key". The purpose of this is so that I can map whatever key they press to a function in the app. Unfortunately, I can not figure out what is the correct interface to use to detect the key events. My class looks like this: public class ScancodeDialog extends Dialog implements OnKeyListener { public ScancodeDialog( Context context ) { super(context); setContentView( R.layout.scancode_dialog ); setTitle( "Key Listener" ); TextView

Navigate Between Activities in an ActivityGroup

北城余情 提交于 2019-12-12 02:46:20
问题 I'm developing an app which contain TabHost ,in one of those tabs i have an ActivityGroup , and from this ActivityGroup , i launch another SubActivity ( let's say that i Launch an Activity A ), and until this , everything is OK. The problem is when i press the BackButton ,the CurrentActivity( Activity A ) is destroyed, but the ParentActivity( The ActivityGroup ) is not resumed , and the app show just a null Window with the Title of My App ( " My Application Title " ) . The Code to launch the

How to submit a form OnKeyPress with Javascript?

為{幸葍}努か 提交于 2019-12-11 11:24:35
问题 I want to make a form like this, and i want to post the form - with javascript - in all the keydowns. <form action="{$formaction}" enctype="multipart/form-data" method="post"> <input type="text" name="n"> <input type="password" name="pw"> <button name="in" type="submit">enter</button> </form> please tell me how to do this. 回答1: <form onkeydown="this.submit();"> <!-- form content --> </form> 回答2: <body onkeydown="document.forms["myform"].submit();"> 回答3: If you do that, the page will reload,

Android Chrome input onkeydown

与世无争的帅哥 提交于 2019-12-11 03:37:41
问题 I have reduced this to the minimum code to show this problem. The problem is that this works fine on Chrome on my computer, but on Chrome on my Android, it doesn't work properly. First, the highly simplified code: <html><head><script language='javascript'> function kd(e) { inp = document.getElementById('myinput'); if(inp.value=='example') inp.value=''; return true; } </head><body> <input type='text' id='myinput' value='example' onkeydown='return kd(event);'> </body></html> On my computer, I

jquery - in keyDown erase text from input

和自甴很熟 提交于 2019-12-10 21:18:45
问题 I have a input box that i have some text in site <input type="text" value="Enter Name"/> Now i need to add that when the user starts typing in something (enters the first letter), my text will disappear and he will be able to enter the input he wants. I tried doing: $('#input').keypress(function () { $(this).val(""); }); But then the user can only enter one letter cuz it keeps on deleting the text. How can this be done? Thanks 回答1: You can do this by using a placeholder Demo: http://jsfiddle

Minimize activity on back key press

北城以北 提交于 2019-12-10 03:26:38
问题 OnBack Key press i want to minimize the application, How can i do this??? public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { //Here i want to put minimize code.. pls give me this statement return true; } return super.onKeyDown(keyCode, event); } Thanks 回答1: public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { this.moveTaskToBack(true); return true; } return super.onKeyDown

How to force “enter key” to act as “tab key” using javascript?

杀马特。学长 韩版系。学妹 提交于 2019-12-09 04:44:37
问题 I'm working on a site that is full of forms to be filled and I it's required that when escape button is pressed focus move to the next input control, just as pressing "tab" do. I found code to move focus when keypressed is 13 but this need to take the ID of element to focus on <input id="Text1" type="text" onkeydown="return noNumbers(event)" /> <input id="Text2" type="text" /> <script type="text/javascript"> function noNumbers(e) { keynum = e.which; if (keynum == 13) document.getElementById(

Android wear activity onKeyDown is not getting called

风流意气都作罢 提交于 2019-12-08 04:40:30
This is not a duplicate but a specific case to Android wear. I am trying to make Android wear app do something when certain gestures are performed. But I realized that the onKeyDown() event is not called at all. Any help or info I this regard is useful. Here is my simple code snippet. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gesture_ema); Log.d(TAG, "Inside on create"); //Show prompt window on top always getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + WindowManager.LayoutParams

simple javascript keystroke count

浪尽此生 提交于 2019-12-08 03:29:41
问题 I'm developing an online study/survey where I need to count the number of keystrokes that a participant makes. I am asking them to type lrlrlrlrlrlrl... in a text field to simulate walking. Turns out many of the participants (as evidenced by the time spent on the task) are copying and pasting. I need something that will count keystrokes so I can identify participants who completed the task as requested. The study is programmed in Coldfusion and I was thinking about some sort of javascript