How can I get the context in a fragment?
I need to use my database whose constructor takes in the context, but getApplicationContext() and Fragmen
getApplicationContext()
Fragmen
For Kotlin you can use context directly in fragments. But in some cased you will find an error like
context
Type mismatch: inferred type is Context? but Context was expected
for that you can do this
val ctx = context ?: return textViewABC.setTextColor(ContextCompat.getColor(ctx, android.R.color.black))