daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Jan 16th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class MainActivity : AppCompatActivity() {
  2.  
  3.     override fun onCreate(savedInstanceState: Bundle?) {
  4.         super.onCreate(savedInstanceState)
  5.         setContentView(R.layout.activity_main)
  6.  
  7.         hideKeyboard(this)
  8.     }
  9.  
  10.     private fun hideKeyboard(activity: Activity) {
  11.         val imm = activity.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
  12.         var view = activity.currentFocus
  13.         if (view == null) {
  14.             view = View(activity)
  15.         }
  16.         imm.hideSoftInputFromWindow(view.windowToken, 0)
  17.     }
  18.  
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top