I\'ve updated the SDK to the latest version (API 23) and the onAttach(Activity)
method for fragment is deprecated. So instead of using that method, now I\'m usi
I solved the problem in this way:
@TargetApi(23)
@Override public void onAttach(Context context) {
//This method avoid to call super.onAttach(context) if I'm not using api 23 or more
//if (Build.VERSION.SDK_INT >= 23) {
super.onAttach(context);
onAttachToContext(context);
//}
}
/*
* Deprecated on API 23
* Use onAttachToContext instead
*/
@SuppressWarnings("deprecation")
@Override public void onAttach(Activity activity) {
super.onAttach(activity);
if (Build.VERSION.SDK_INT < 23) {
onAttachToContext(activity);
}
}
/*
* This method will be called from one of the two previous method
*/
protected void onAttachToContext(Context context) {}