Skip to content Skip to sidebar Skip to footer

Java.lang.illegalargumentexception: No View Found For Id 0x7f0c007b

I tried to start a App project and now i get the following error. I tried a lot from the answers that i found here on the side, but I don't found my mistake. Here is the output:

Solution 1:

A FragmentTransaction replaces a View within your Activity hierarchy with your Fragment. The View with the ID R.id.relativeLayout_for_About is in the layout your are using for your Fragment, not the layout of the Activity. Add a View in your R.layout.activity_main where you want your AboutFragment to appear:

<FrameLayout android:id="@+id/placeholder_about"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

Then replace this View with your AboutFragment:

Fragmentfragment=newAboutFragment();

getSupportFragmentManager().beginTransaction()
        .replace(R.id.placeholder_about, fragment).addToBackStack(null).commit();

You can read more about this paradigm in the Developer Training docs.

Post a Comment for "Java.lang.illegalargumentexception: No View Found For Id 0x7f0c007b"