keyevent

Android onkey - dispatchKeyEvent not firing

跟風遠走 提交于 2019-12-23 09:49:37
问题 well, I've tried all the solutions I could find on stackoverflow and in other places, but the end result hasn't changed one bit: the only key that triggers the onKey event or the dispatchKeyEvent is the enter key on the virtual keyboard, and only if pressed twice. I cannot intercept any other key (there's a breakpoint at the top of the event and eclipse never stops on it, except for in case of the aforementioned enter). Beheaviour is the same on both emulator and real device. Any ideas? Thank

keycode shortcut each function

隐身守侯 提交于 2019-12-23 04:44:00
问题 I'm working yet on a small script to capture keyevents and easily bind functions on them. But I'm stuck for now! The problem is, that if I initalize more than one "eventhandler" it overides arguments from the first initialization. Thousands of words do not say more than some lines of code. So, here's what I've done so far: var keyCodes={a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,"0":48,"1":49,"2":50,"3":51,

Back key or Delete key of Soft Keyboard not working in 4.4 and 5.0?

非 Y 不嫁゛ 提交于 2019-12-23 04:35:44
问题 I am facing the issue of back key or del key which is not working in 4.4 and 5.0.1 devices ? When I press the back key of softkeyboard below method is not calling. Username.setOnKeyListener(controller); Password.setOnKeyListener(controller); @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if(event.getAction() == KeyEvent.KEYCODE_DEL){ getActivity().setDisableLoginButton(); } return false; } Anyone suggest me what should I do ? I am disabling the button if there's no

Java: change “VK_UP” to KeyEvent.VK_UP

断了今生、忘了曾经 提交于 2019-12-23 02:44:35
问题 I need to change/parse text like "VK_UP" (or simply "UP" ) to the KeyEvent.VK_UP constant in Java. I dont want to use the number 38 instead since it will be saved in a .txt config file so anybody could rewrite it. Best solution would be to have this hashmap: HashMap<String, Integer> keyConstant; Where key would be the name ( "VK_UP" ) and value would be key code ( 38 ). Now the question is: How can I get this map without spending all evening creating it manually? 回答1: You can use reflection.

Overriding lock/power button in android devices

℡╲_俬逩灬. 提交于 2019-12-22 19:15:32
问题 I would like to know if its possible to override power button in android? I read a lot of posts in Stack Overflow, some saying it's possible and some saying it's not (example). What I am trying to achieve is that - when user is using my app he needs to press the lock/power button 5 times to lock the screen. I dont want to override the swtich off functionality only the lock one. Is there anyway to fetch power button callback? I tried WakeLock and disabled the keyguard but it does'nt serve my

How to create a KeyEvent

感情迁移 提交于 2019-12-22 17:56:22
问题 When i create the KeyListener , it requires the following fields: public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } When i put System.out.println(e) into the keyPressed method, though, it returns this when i press the enter key: java.awt.event.KeyEvent[KEY_PRESSED,keyCode=10,keyText=?,keyChar=?,keyLocation=KEY_LOCATION_STANDARD,rawCode=0,primaryLevelUnicode=0,scancode=0] on javax.swing.JButton[,1,1,100x100,alignmentX=0.0

Skipping over Java KeyEvents

て烟熏妆下的殇ゞ 提交于 2019-12-22 15:36:41
问题 I have a program where the user can press a key to perform an action. That one event takes a small amount of time. The user can also hold down that key and perform the action many times in a row. The issues is that the keyPress() events are queued up faster than the events can be processed. This means that after the user releases the key, events keep getting processed that were queued up from the user previously holding down the key. I also noticed that the keyRelease event doesn't occur

Scroll webView with volume keys

本小妞迷上赌 提交于 2019-12-22 01:02:35
问题 How do you scroll a webView w/ the volume hard keys? ...and can it be done with easing? If so, how? I'm a nooB to Android - Coming over from ActionScript and any help will be greatly appreciated. my R.id.webPg001 is a WebView id. This is where I'm at now: @Override public boolean dispatchKeyEvent(KeyEvent event) { int action = event.getAction(); int keyCode = event.getKeyCode(); ScrollView scrollView; scrollView = (ScrollView) findViewById(R.id.webPg001); switch (keyCode) { case KeyEvent

How to move a Bug in GridWorld with arrow keys

ぐ巨炮叔叔 提交于 2019-12-21 20:58:52
问题 I'm making a game for my computer Science class and I am trying to move a character object that extends Bug with the arrow keys. Should I put the code to move with the arrow keys in the Character class or in the World class? And what should the code look like? Right now I've got this code in the Character class and it complies fine, but when I try to to run it in the grid nothing happens when I press the arrow keys. public class Character extends Bug { Random pokemon; public Character() { }

Javascript keyevent and JAWS screen reader

我怕爱的太早我们不能终老 提交于 2019-12-21 05:51:30
问题 I have an application that does something (eg alert) each time a spacebar is pressed. This works fine if I am not using JAWS screen reader. However, once I load JAWS screen reader, it does not execute alert when I press the spacebar. I need to use JAWS so I need this to work. Here is the code snippet. $(document).keypress(function(event) { var chCode = ('charCode' in event) ? event.charCode : event.keyCode; if (chCode == 32){ //32 is keyCode for spacebar alert("spacebars!!!"); } }); From my