3

I'd like to know if there's a way to receive events for the soft keyboard. Only to know when it is opened(shows up).

I need this to update my view accordingly but can't find anything about it on the web.

I understand the keyboard is part of the system, though I wonder if anyone ever found a way.

EDIT

Thank you all for trying to help, my bad I wasn't clear enough. I want to know when the keyboard is opened using an Accessibility Service.

For a floating view I have that is on top of an app that isn't my own, so I can't use the activity events you mentioned I think.

ntwired33
  • 53
  • 7

2 Answers2

0

Your question is very close with this Soft keyboard open and close listener in an activity in Android

Check this link : Soft keyboard open and close listener in an activity in Android

There are lots of solutions here.

Faisal Russel
  • 139
  • 1
  • 4
-1

This is not a easy question but I will give it a try.

Question: I'd like to know if there's a way to receive events for the soft keyboard. Only to know when it is opened(shows up).

Answer: No, there are no such listeners.

Is there a Workaround?

Answer: Yes there is:

Soft keyboard open and close listener in an activity in Android

  • That work around doesn't work very well. THere's at least a dozen situations in which it fails. The better answer is to not write a UI that requires this functionality, and to find another way to do things. – Gabe Sechan Jul 23 '19 at 23:36
  • It seems like the Workaround helped a lot of people so I don't see the problem. If your answer is: Not to write a UI with this functionality, then post it as an Answer and not a comment to my answer. – TheScribbler2019 Jul 23 '19 at 23:43
  • The problem is it doesn't work a lot of the time. The above comment was necessary so the asker realizes that. – Gabe Sechan Jul 23 '19 at 23:56
  • Like I mentioned above. I don't have time for games. There are more than 10 solutions in that link with many upvotes and you just post that they are all wrong and that they don't work. Sorry, sounds like a game to me. – TheScribbler2019 Jul 24 '19 at 01:14
  • 1
    No I'm correcting you. They work-sometimes. As comments on each of those answers say. Use them at your own risk, as they will not work under split screen, picture in picture, when screen casting, if the keyboard was up when your activity opened, or a dozen other conditions. All of which you're ignorant of. – Gabe Sechan Jul 24 '19 at 02:46
  • Thank you, I've clarified some more in the edit of the post – ntwired33 Jul 29 '19 at 23:11