# Detecting key press only once in Libgdx

Have a question on keyboard inputs. Currently I am using this method to read my input, Gdx.input.isKeyPressed(Input.Keys.A), it is working fine. But I do realized at times there are multiple instances of A being pressed when I only press once. And I understand that the method had to be placed in the render() method for it to work. Is the problem due to the refreshing?

My question is, how can I only detect 1 instance of "A", when A is pressed for once.

• Maybe I should clarify myself, when i detected the key then the textfield will be updated with the input. Oct 1, 2013 at 14:49
• Eh, I think i got what you mean, Thanks for the help :) Oct 1, 2013 at 14:59

if(newInput.isKeyPressed(Input.Keys.A) && oldInput.isKeyUp(Input.Keys.A))