' first we need the DecorView of the activity
Dim jo As JavaObject = activity
Dim DecorView As View = jo.RunMethod("getRootView", Null)
If DecorView <> Null Then
' check if the keyboard is visible
Dim keybVis As ABKeyboardVisible
Dim KeyboardVisible As Boolean = keybVis.IsVisible(DecorView, False)
If KeyboardVisible Then
myIME.HideKeyboard
end if
end if