2

I get an error

No view found for id 0x7f080064 (com.developer.ugadaimelodiu:id/container) for fragment FragmentMain{42e4e43 (47b0d98e-e087-442a-8b35-31b8ffd4782a) id=0x7f080064}

when I call:

    ftrans.replace(R.id.container, fmain);

I use:

    import androidx.fragment.app.FragmentTransaction;

    FragmentTransaction ftrans = getSupportFragmentManager().beginTransaction();
            ftrans.replace(R.id.container, fmain);
            ftrans.commit();

I don’t understand why I get this error. ID content announced
my content_main.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/container"
        tools:context=".MainActivity"

        />

apparently container ID exists, but android studio gives an error.

How do I solve the problem?

0 Answers0