Android:AdMob onClickListener
                                        
                    •
                    Android                                    
                I display the banner of AdMob in the Android application. I hope it disappears when the user clicks on the banner. I've tried the code adview.setonclicklistener, but it doesn't work
Editor: This is the code
private void visual_banner(){
//##### Pubblicità #####
        //Create the adView    
        adView = new AdView(this, AdSize.BANNER, "a14e5bed604ebf8");   
        // Lookup your LinearLayout assuming it’s been given    
        // the attribute android:id="@+id/mainLayout"    
        LinearLayout layout = (LinearLayout)findViewById(R.id.layout_ads_streaming);    
        // Add the adView to it    
        layout.addView(adView); 
        // Initiate a generic request to load it with an ad    
        adView.setOnClickListener(new OnClickListener(){
            @Override
            public void onClick(View arg0) {
                adView.destroy();
                img.setVisibility(View.VISIBLE);
            }
        });
        adView.loadAd(new AdRequest());
        //### FINE PUBBLICITA'
}
resolvent:
Adwhirl added, I can help you
I met the source and did the following:
public class AdWhirlLayoutCustom extends AdWhirlLayout {
public AdWhirlLayoutCustom(Activity context, String keyAdWhirl) {
    super(context, keyAdWhirl);
}
public AdWhirlLayoutCustom(Context context, AttributeSet attrs) {
    super(context, attrs);
}
// We intercept clicks
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
    boolean result = super.onInterceptTouchEvent(event);
    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
                    // Click!
        break;
    }
    return result;
}
}
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        