Created
June 24, 2018 13:17
-
-
Save gahfy/2ab9514b52e1bc072adbaa0e84874238 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
fun View.getParentActivity(): AppCompatActivity?{ | |
var context = this.context | |
while (context is ContextWrapper) { | |
if (context is AppCompatActivity) { | |
return context | |
} | |
context = context.baseContext | |
} | |
return null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment