Last active
July 22, 2018 15:39
-
-
Save premnirmal/39241f9f00bee9aa23174df0de5f47b5 to your computer and use it in GitHub Desktop.
This file contains 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
class BrowseRecipesFragment : Fragment(), View.OnClickListener { | |
private var recipeClickListener: RecipeClickListener? = null | |
... | |
override fun onAttach(context: Context) { | |
super.onAttach(context) | |
recipeClickListener = context as RecipeClickListener | |
} | |
override fun onDetach() { | |
super.onDetach() | |
recipeClickListener = null | |
} | |
override fun onClick(v: View) { | |
recipeClickListener!!.onRecipeClicked(recipe) | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment