오류일지
[오류일지]15. Android Studio - Fragment 사용시 주의점
devRobin
2022. 3. 12. 19:42
1. Fragment에서는 Activity를 호출하지 못하므로 부모 Activity를 이용하여 호출
Intent intent = new Intent(getActivity(),HomeActivity.class);
startActivity(intent);
2. findViewById를 사용할때에는 다음과 같이 해야한다.
View v =inflater.inflate(R.layout.fragment_profile,container,false);
nameEdit = v.findViewById(R.id.nameEdit);