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
Since API level 23 there is getContext() but if you want to support older versions you can use getActivity().getApplicationContext() while I still recommend using the support version of Fragment which is android.support.v4.app.Fragment.
getContext()
getActivity().getApplicationContext()
Fragment
android.support.v4.app.Fragment