I\'m trying to follow data-binding example from official google doc https://developer.android.com/tools/data-binding/guide.html
except that I\'m trying to apply data
The data binding implementation must be in the onCreateView method of the fragment, delete any data Binding that exist in your OnCreate method,
your onCreateView should look like this:
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
MartianDataBinding binding = DataBindingUtil.inflate(
inflater, R.layout.martian_data, container, false);
View view = binding.getRoot();
//here data must be an instance of the class MarsDataProvider
binding.setMarsdata(data);
return view;
}