Android Question EditText.SetKeyListener(Null)

TheWind777

Active Member
Licensed User
Longtime User
I have, so far unsuccessfully, been able to stop the keyboard from coming up in my face.

I have used the methods such as using the IME.HideKeyboard from a Focus Event, and from a Click event also at the same time. The keyboard just keeps coming back.

I found evidence out on the web that if you could just set the EditText.SetKeyListener(Null)... the keyboard would be gone; but the ability to copy and paste would remain.

Since that is exactly what I want to happen. I have been trying, rather desperately, to try and get at the EditText.SetKeyListener instance and set it to null.

I would guess it to be a quite easy thing if I actually knew what I was doing.

I should be able to get there one of three ways (none of which are working).

With the IME library, with the Reflector library, or with the Java library.

...
I found this code, which seems to be quite close to what I need to grab...

Dim obj1 As Reflector
obj1.Target = edt
obj1.RunMethod2("setFocusable", "False", "java.lang.boolean")

In my case it should be more like:

Dim RemoveKeyListener as Reflector

RemoveKeyListener.Target = EditTextWBLesson
RemoveKeyListener.RunMethod2("setKeyListener","Null","java.lang.Object")

(Although it would seem that it would really be more like:


java.awt.event.KeyListener

Secondarily... if I were to use the IME library, possibly the
IME.AddHandleActionEvent(EditText)

coupled with a:

Sub IME_HandleAction As Boolean
End Sub

With some manipulation either before, or after with
RunMethod2("",etc
might work.

Anybody much smarter than I am have any thoughts?
 

TheWind777

Active Member
Licensed User
Longtime User
Anyways. All the other methods have failed. I believe that the method I just outlined would work.

I don't believe it would be hard to do for someone skilled with java and the Reflector library.

There would be no problem at all if B4A gave you the EditText.SetKeyListener()

And, with what looks like it would be a simple thing. You just would pass Null to that function.

That would do what I need and should be super-simple for those who know the Reflector library well.

It would be a matter of what is termed "java.awt.event.KeyListener"

And you would be passing it a Null value, instead of the KeyListener... Object?

In my case the name of the two EditText boxes I need that function on are EditTextWBLesson and EditTextACIMChapter.

So, in the end it should go something like:

RemoveKeyListener.Target = EditTextWBLesson
RemoveKeyListener.RunMethod2("setKeyListener","Null","java.(SOMETHING)")

is my guess... or something very close to that.

...

And, if that .ZIP file is somehow the answer to my problem; exactly how is it the answer?

It seems to not inhibit the keyboard in any more reliable way than any other of the methods people have suggested.

In every way that utilizes the _FocusChanged function, even coupled with the _Click event as well, it only works sometimes, sporadically, and when it wishes to. Or, you see a very unprofessional opening, then closing, of the keyboard.

I believe that my method, if someone actually could do it, would be a complete end to the keyboard without losing the capability to click on a word can copy it to the clipboard (which is my need) WITHOUT ever popping up the keyboard at all.
 
Upvote 0
Top