I’m on Listing 20.7 Configuring RecyclerView (BeatBoxFragment.java)
The compiler won’t recognize the recyclerView symbol field for binding.
A copy and paste is shown below, see the line of code that reads …
binding.recyclerView.setLayoutManager( new GridLayoutManager(getActivity(),3));
What am I doing wrong??
package com.bignerdranch.android.beatbox;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bignerdranch.android.beatbox.databinding.FragmentBeatBoxBinding;
public class BeatBoxFragment extends Fragment {
public static BeatBoxFragment newInstance() {
return new BeatBoxFragment();
}
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
FragmentBeatBoxBinding binding = DataBindingUtil
.inflate( inflater, R.layout.fragment_beat_box, container, false);
binding.recyclerView.setLayoutManager( new GridLayoutManager(getActivity(),3));
return binding.getRoot();
}
}