Post Reply Subscribe to Thread Email Thread

How to add Admob in Custom Dialog?

4th March 2014, 07:46 PM |#1  
OP Junior Member
Thanks Meter: 0
7 posts
Join Date:Joined: May 2013
Hi guys!

I'm trying to implement Admob banner in Custom Dialog box.

I want to make in in XML 'cause i'm thinking this is simplier to change it positions etc.

So here is fragment from my GameActivity where is Custom Dialog too.

Fragment with dialog:

 public void showRestartDialog() {

	    final Dialog dialog = new Dialog(GameActivity.this);

	    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(;


	    //set up image view
        ImageView img = (ImageView) dialog.findViewById(;

    int highest = PrefUtil.getHighestScore(this);
    String text = null;
    if (currentPoint > highest) {
      highest = currentPoint;
      PrefUtil.setHighestScore(this, currentPoint);
    } else {
    text = "\n  " + currentPoint + "\n\n  " + highest;

       TextView text1 = (TextView)
       AdView adView = (AdView)dialog.findViewById(;
       AdRequest adRequest = new AdRequest.Builder().build();

Where is a problem? With this code, the dialog is showing but without banner.
Help me please!


PS. If You need more code, please tell me.
Last edited by dawidurus; 4th March 2014 at 07:51 PM.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes