Guest User

Untitled

a guest
Jan 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. userInput.setOnKeyListener(new OnKeyListener(){
  2. @Override
  3. public boolean onKey(View v, int keyCode, KeyEvent event) {
  4. if (event.getAction() == KeyEvent.ACTION_DOWN) {
  5. lastInput = (char)event.getUnicodeChar();
  6. return false;
  7. }
  8. return true;
  9. }
  10. });
  11.  
  12. enterLetterButton.setOnClickListener(new OnClickListener(){
  13. public void onClick(View arg0) {
  14.  
  15. guess(lastInput);
  16.  
  17. }
  18. });
  19.  
  20. public void guess(char guess) {
  21.  
  22. if (text.toString().indexOf(lastInput) != -1) {
  23. text.setSpan(new ForegroundColorSpan(Color.BLACK), 0, text.length(), 0);
  24. }
  25. // if all-show gameEnd();
  26. else {
  27. showImages();
  28. }
  29. }
Add Comment
Please, Sign In to add comment