When working with fragments, instead of using this
or refering to the context, always use getActivity()
. You should call
Java
getActivity().finish();
Kotlin
activity.finish()
to finish your activity from fragment.
When working with fragments, instead of using this
or refering to the context, always use getActivity()
. You should call
getActivity().finish();
activity.finish()
to finish your activity from fragment.