Created
April 29, 2016 15:15
-
-
Save Kishanjvaghela/7339260c2c4c0552cdaef237fc25365b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* onAttach(Context) is not called on pre API 23 versions of Android and onAttach(Activity) is deprecated | |
* Use onAttachToContext instead | |
*/ | |
@TargetApi(23) | |
@Override | |
public void onAttach(Context context) { | |
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 < Build.VERSION_CODES.M) { | |
onAttachToContext(activity); | |
} | |
} | |
/* | |
* Called when the fragment attaches to the context | |
*/ | |
protected void onAttachToContext(Context context) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment