Or Continue to Thread: How to add Admob in Custom Dia…
Find Your Device:
4th March 2014, 07:46 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
8 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:

Code:
 public void showRestartDialog() {


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

	    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
	    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

	    dialog.setContentView(R.layout.activity_dialog);

	    //set up image view
        ImageView img = (ImageView) dialog.findViewById(R.id.imageView1);
        img.setImageResource(R.drawable.puste);

    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)
    		   
    		   
    		   
    		   
    		   
    		   dialog.findViewById(R.id.TextView01);
       text1.setText(text);
       AdView adView = (AdView)dialog.findViewById(R.id.adView);
       AdRequest adRequest = new AdRequest.Builder().build();
       adView.loadAd(adRequest);

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

Greetings!

PS. If You need more code, please tell me.
Last edited by dawidurus; 4th March 2014 at 07:51 PM.