Hi All ~ Is that possible to disabled admob ads after clicked ? I tried with this code but nothing happened, can anyone please help me out ? Thanks in advance
final LinearLayout layout = ( LinearLayout )findViewById( R.id.adslayout ) ;
final AdView adView = new AdView( this, AdSize.BANNER, "a11111111b9041" ) ;
layout.addView( adView ) ;
adView.setVisibility( View.VISIBLE ) ;
adView.loadAd( new AdRequest() ) ;
adView.setOnClickListener( new View.OnClickListener()
{
public void onClick( View v )
{
layout.removeAllViews() ;
adView.setVisibility( View.GONE ) ;
ed.putBoolean( "adsClicked", true ) ;
ed.commit() ;
} // onClick()
} );
If your class implements AdListener, you can put your disable code into onDismissScreen(). This method is called when the user closes the advertisement and returns to your app.
For example:
public class Advertisement implements AdListener{
// more code here
@Override
public void onDismissScreen(Ad arg0) {
mainLayout.removeView(adView);
}
// more code here
}