title: Admob(Ads) in Custom Alert Dialog
body: <p>In the market I saw an app is displaying admob in the alert dialog . after I reading <a href="https://stackoverflow.com/questions/4003701/how-do-i-put-an-admob-adview-in-the-settings-screen-for-a-live-wallpaper">this</a> and <a href="https://stackoverflow.com/questions/2644134/android-how-to-create-a-dialog-without-a-title">this</a> and <a href="http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog" rel="nofollow noreferrer">this</a> ,</p>
  
  <p>I still can't figure out how to display the ads in alert dialog same like the one below. (or any others method , that can display the ads in a alert dialog)</p>
  
  <p><img src="https://i.stack.imgur.com/r1KPI.png" alt="enter image description here"></p>
  
  <p>I've been scratching my head trying to figure out how
  to do that.</p>
  
  <p><strong>Could anyone be kind enough to guide me through how
  to go about this?</strong></p>
  
  <p>XML :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TableLayout android:id="@id/tablayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="*"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:myapp="http://schemas.android.com/apk/res/com.xxx.xxx"&gt;
  
      &lt;TableRow&gt;
    &lt;com.admob.android.ads.AdView android:id="@id/myad" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    myapp:backgroundColor="#ff000000" 
    myapp:primaryTextColor="#ffffffff" 
    myapp:secondaryTextColor="#ffcccccc" /&gt;
      &lt;/TableRow&gt;
  
  &lt;/TableLayout&gt;
  </code></pre>
  
  <p>Java :</p>
  
  <pre><code> public void onBackPressed() {
      //set up dialog
                  Dialog dialog = new Dialog(main.this);
                  dialog.setContentView(R.layout.exitdialog);
                  dialog.setTitle("This is my custom dialog box");
                  dialog.setCancelable(true);
  
  
                  //set up button
                  Button button = (Button) dialog.findViewById(R.id.Button01);
                  button.setOnClickListener(new OnClickListener() {
                  @Override
                      public void onClick(View v) {
                          finish();
                      }
                  });
                  //now that the dialog is set up, it's time to show it    
                  dialog.show();
              }
          });
  }
  </code></pre>
  
  <p>Thanks.</p>