'how can getActivity() in android is called without the help of any object

Activity activity = getActivity();
            if (null != activity) {
                activity.finish();
            }   

//here getActivity() method is called and assigned to the activity reference.my question is that how we can called the method without object and assign to the reference..



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source