user836026
user836026

Reputation: 11350

What is the use of PlaceholderFragment Segement

I'm following the quick start guide on how to add Admob ad to Android Admob Quick start for Android

I saw on the layout XML file the are 2 Segment as shown below:

<fragment android:name="com.google.android.gms.example.bannerexample.MainActivity$PlaceholderFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/adFragment" />

    <fragment
        android:id="@+id/adFragment"
        android:name="com.google.android.gms.example.bannerexample.MainActivity$AdFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" />

when I integrated this to my application. The were run time error where it says it couldn't inflate the layout XML file. However, when I removed the the first Segment "MainActivity$PlaceholderFragment" everything works fine. Hence, is there any problem if I removed the first segment?

Upvotes: 2

Views: 9803

Answers (1)

Rohit5k2
Rohit5k2

Reputation: 18112

MainActivity$PlaceholderFragment is just a fragment inside MainActivity to show that it is going to be displayed there on the screen. This is just an example. You can modify according to your needs.

You getting that error probably because your MainActivity doesn't have any fragment called PlaceholderFragment.

There is absolutely no problem in deleting that. Its just that no fragment will be displayed as a placeholder

Upvotes: 3

Related Questions