1

I'm trying to load a admob banner ad on a Dialog.

  final Dialog dlg = new Dialog(getActivity());
  dlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
  dlg.setContentView(R.layout.custom_menu_share);    

  LinearLayout linear = (LinearLayout)dlg.findViewById(R.id.second_top_layout);
  AdView ad = new AdView(getActivity());
  ad.setAdSize(AdSize.SMART_BANNER);
  ad.setAdUnitId(BuildConfig.banner_ad_unit_id);
  AdRequest adRequest = new AdRequest.Builder()
                                     .addTestDevice("*************")
                                     .build();

  linear.addView(ad);
  ad.loadAd(adRequest);

The ads are not coming up, it just shows a blank area instead of a banner ad. But if I use the same credentials on a full page Activity, the ad comes up correctly.

What might be the problem ?

Gissipi_453
  • 1,250
  • 1
  • 25
  • 61

0 Answers0