Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Compatibility Issue #786

Closed
strooonger opened this issue Dec 14, 2017 · 1 comment · Fixed by #787
Closed

Potential Compatibility Issue #786

strooonger opened this issue Dec 14, 2017 · 1 comment · Fixed by #787

Comments

@strooonger
Copy link
Contributor

Hi, I notice in class RulesPreferenceFragment.java you have used function onAttach(Context), which is added in API version = 23. However, onAttach(Context) will not execute in API version < 23 (See this link).

Class RulesPreferenceFragment directly extends android.preference.PreferenceFragment. As the official document of Android shows, android.preference.PreferenceFragment directly extends android.app.Fragment, unfortunately in practice onAttach(Context) will not executed if one use android.app.Fragment. If you put some important operation into this function, the program may not execute normally in API<23.

My suggestion is simply changing android.preference.PreferenceFragment to android.support.v7.preference.PreferenceFragmentCompat, which have the same function as android.preference.PreferenceFragment, but does not have this potential compatibility issue.

@ukanth
Copy link
Owner

ukanth commented Dec 14, 2017

Thanks for the suggestion. Is it possible to make a pull request ?

@strooonger strooonger mentioned this issue Dec 15, 2017
ukanth added a commit that referenced this issue Mar 12, 2018
Fix #786 - Getting context on SDK < 23 on Preference Fragment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants