Search code examples
androidandroid-compatibility

onAttach() in the compatibility library ListFragment


I want to override the onAttach() http://developer.android.com/reference/android/app/Fragment.html#onAttach(android.app.Activity) method of a ListFragment from the compatibility library, but it seems it can't be found... am I getting something wrong, or maybe this method is not implemented in the compatibility library and I will have to override another method?List


Solution

  • I've tried to override:

    @Override
    public void onAttach(Activity activity) {
        // TODO Auto-generated method stub
        super.onAttach(activity);
    }
    

    where I should have override:

    @Override
    public void onAttach(SupportActivity activity) {
        // TODO Auto-generated method stub
        super.onAttach(activity);
    }
    

    Notice the: "Activity" of the first method and the: "SupportActivity" of the second..