Android/Android 실습

Fragment onAttach(Activity activity) deprecated 해결

Sharpen 2016. 3. 17. 13:03
onAttach (Activity activity)

It's now:

onAttach (Context context)

As my app uses the activity passed before deprecation, a possible solution i think is:

이전 코드

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mActivity = (FragmentActivity) activity;
}


deprecated 해결 코드

@Override
public void onAttach(Context context) {
super.onAttach(context);
mActivity = getActivity();
}