Can not resolve method ‘findViewById(int)’
You need to do this in onCreateView:
You need to do this in onCreateView:
Use getView() or the View parameter from implementing the onViewCreated method. It returns the root view for the fragment (the one returned by onCreateView() method). With this you can call findViewById(). As getView() works only after onCreateView(), you can’t use it inside onCreate() or onCreateView() methods of the fragment .