My app is using navigation drawer. Upon clicking on the item in the drawer, it will display a fragment. And I put the AdMob code inside the fragment, as displayed below:
public class MenuIncome extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.menu_income, container, false);
AdView mAdView = (AdView) rootView.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
mAdView.destroy();
return rootView;
}
}
Before I put the AdMob code, my fragment would be displayed instantaneously upon clicking an item on the navigation drawer. But after I put the AdMob code, when I click an item on the drawer, sometimes my app would be liked freezed for up to 1 second, then only the fragment (with the ad) would be displayed.
Why do this happen? I thought AdView have already load its ad asynchronously.