Some elements in view binding cannot be resolved

18 Views Asked by At

I have this code in android studio, who put some TextView elements from a xml in a table, but for some of them, the reference is not detected, so i'm obligated to use findViewById

private ActivitySurfaceBinding ui;
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ui = ActivitySurfaceBinding.inflate(getLayoutInflater());
        setContentView(ui.getRoot());
        TextView[] labels = new TextView[]{
        ui.heightPave, ui.lengthPave, findViewById(R.id.widthPave), 
        ui.heightPaveUnit, ui.lengthPaveUnit,findViewById(R.id.widthPaveUnit),
        ui.rayonCyl, ui.rayonCylUnit, findViewById(R.id.rayOrDiamCyl), 
        ui.heightCyl, ui.heightCylUnit, findViewById(R.id.heightCyl), 
        findViewById(R.id.heightCylUnit), findViewById(R.id.diametreCyl),
        findViewById(R.id.diametreCylUnit)
};

For now, what i have tried to resolve it is :

  • Update Android studio
  • Clean / Rebuil the project
  • Sync the project
  • Check compilation error
  • Invalidate caches
  • Deactivate and reactivate viewbinding in gradle file

But none of them worked.

0

There are 0 best solutions below