I am very confused with the usage of all these that where should we use them.
Activity is a subclass of Context, so whenever a context is required, either can be given.
getActivity() is at least a method on Fragment, to get the activity it is attached to.
Whenever a context is needed in an instance method of an activity, you can use this.
A context is needed whenever contextual info is needed, or when stuff needs to be displayed.