Focus and keyboard ...

Hubert Brandel

Active Member
Licensed User
Longtime User
Hi,

I open a activity with a multiline edittext view and two buttons (OK, Cancel)
I load some text bevor and save the edited text after OK. That works, but...

I want to set the focus inside the edittext and show the virtual keyboard.
I tried it this way:

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Log("EdtBem start: " & sBemerkung ) ' OK
   Activity.LoadLayout("WinBemerkung") ' will show
   Activity.Title    = main.sTitle & " - Bemerkungen" ' OK
   edtBemerkung.Text = sBemerkung ' OK
   edtBemerkung.RequestFocus ' ?
   edtBemerkung.InputType = edtBemerkung.INPUT_TYPE_TEXT ' ?
   DoEvents
End Sub

I got the edittext with the right old text to edit and there is a small cursor in the view, but there is NO keyboard ...
If I touch the edittext view, the right keyboard will come .

And after i touch OK, the text is saved, the activity is closed and I see the starting activity, BUT WITH the keyboard ...

B4X:
Sub Activity_Pause (UserClosed As Boolean)
   Log("EdtBem Stop: (" & UserClosed & ") " & sBemerkung ) 
   edtBemerkung.InputType = edtBemerkung.INPUT_TYPE_NONE
   DoEvents
End Sub

I thought I could hide by this, but this does not work.

Any Idea ?

PS: I can hide the keyboard by pressing the phones BACK button, but I need it automatic ;-)
 

Hubert Brandel

Active Member
Licensed User
Longtime User
this will hide the Keyboard perfectly ...
B4X:
dim p as phone
p.HideKeyboard (Activity )

but isn't there a function for show it automatic ?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Erel has answered this here

I have played with this too, and after a couple of hours I thought I could have written a keyboard to do what I want by now, so that's what I'm doing.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
@ Koverhage

Yes, that's about as far as I got yesterday, but as Andrew points out in his post, it doesn't work reliably for all flavours of Android.
 
Upvote 0

Hubert Brandel

Active Member
Licensed User
Longtime User
Hi,

I am now able to HIDE it. That was most important.

In the link from stevel05 Erel wrote, that this is the normal behavier of Android, so I think thats OK for me ;-)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…