Last active
July 5, 2020 20:17
-
-
Save Kshitij09/1fc272ce9866f1ee20e485046a8e5366 to your computer and use it in GitHub Desktop.
some snippets that could be useful in various scenarios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hide the keyboard on button click | |
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | |
imm.hideSoftInputFromWindow(view.windowToken, 0) | |
// hide the menu item if doesn't resolve | |
// getShareIntent() is supposed to return your intent object | |
if (null == getShareIntent().resolveActivity(activity!!.packageManager)) { | |
menu.findItem(R.id.share).setVisible(false) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pro tip: Use
<merge/>
tag as the root layout when using Android'sNavHostFragment
to eliminate redundant layouts when including layouts. reference