Prefer onViewCreated() over onActivityCreated()
The stated purpose of onActivityCreated() is to wait until the activity is created. That isn't needed here, where what we're actually doing is setting up the binding with the ViewModel, making this more suitable for onViewCreated(). As onActivityCreated() and onViewCreated() happen back to back, there's no actual difference in behavior (just increased clarity on what we're doing).
Showing
想要评论请 注册 或 登录