I had an xml layout which worked fine, but I have tried the AdMob ads inserting an AdView and it isn't working anymore. In the log I can just see the "before" text, but I can't see the "after" text. What could this be due to?
fragment_home.xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*" >
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" >
//Stuff...
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" >
//Stuff...
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" >
//Stuff...
</TableRow>
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/adView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-0771856019955508/3441120220"
ads:adSize="BANNER" />
</TableLayout>
HomeFragment.java
public class HomeFragment extends Fragment {
private View rootView;
private AdView adview1;
private AdRequest adRequest;
public HomeFragment(){}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.e("Et_ad","before");
rootView = inflater.inflate(R.layout.fragment_home, container, false);
Log.e("Et_ad","after");
//Stuff...
adview1 = (AdView)rootView.findViewById(R.id.adView1);
Log.e("Et_ad","adview1");
adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("TEST_DEVICE_ID")
.build();
Log.e("Et_ad","before load adview1");
adview1.loadAd(adRequest);
return rootView;
}