error: cannot find symbol method dowloadandDisplayImage(Image,ImageView)
error: incompatible types: <anonymous AdListener> cannot be converted to NativeAdListener
public void showHomeScreenFacebookAds(View rootView) {
AudienceNetworkAds.initialize(this);
try {
this.nativeExitAd = new NativeAd(this, getResources().getString(R.string.fb_exit_native_id));
this.progressBarExitRefresh = rootView.findViewById(R.id.exit_progress);
this.nativeAdContainerExitAds = rootView.findViewById(R.id.exit_ad_container);
this.progressBarExitRefresh.setVisibility(View.VISIBLE);
this.nativeExitAd.setAdListener(new com.facebook.ads.AdListener() {
public void onError(Ad ad, AdError adError) {
MirrorNewActivity.this.nativeAdContainerExitAds.setVisibility(View.INVISIBLE);
MirrorNewActivity.this.progressBarExitRefresh.setVisibility(View.INVISIBLE);
}
public void onAdLoaded(Ad ad) {
try {
if (MirrorNewActivity.this.nativeExitAd != null) {
MirrorNewActivity.this.nativeExitAd.unregisterView();
MirrorNewActivity.this.adExitView = (LinearLayout) LayoutInflater.from(MirrorNewActivity.this).inflate(R.layout.fb_native_app_box_, MirrorNewActivity.this.nativeAdContainerExitAds, false);
MirrorNewActivity.this.nativeAdContainerExitAds.removeAllViews();
MirrorNewActivity.this.nativeAdContainerExitAds.addView(MirrorNewActivity.this.adExitView);
MirrorNewActivity.this.adExitChoicesContainer = MirrorNewActivity.this.adExitView.findViewById(R.id.lin_choices_container);
ImageView nativeAdIcon = MirrorNewActivity.this.adExitView.findViewById(R.id.fb_native_ad_icon);
TextView nativeAdTitle = MirrorNewActivity.this.adExitView.findViewById(R.id.fb_native_ad_title);
MediaView nativeAdMedia = MirrorNewActivity.this.adExitView.findViewById(R.id.fb_native_ad_mediaview);
TextView nativeAdBody = MirrorNewActivity.this.adExitView.findViewById(R.id.fb_native_ad_body);
Button nativeAdCallToAction = MirrorNewActivity.this.adExitView.findViewById(R.id.fb_native_ad_call_to_action);
nativeAdTitle.setText(MirrorNewActivity.this.nativeExitAd.getAdvertiserName());
nativeAdBody.setText(MirrorNewActivity.this.nativeExitAd.getAdBodyText());
nativeAdCallToAction.setText(MirrorNewActivity.this.nativeExitAd.getAdCallToAction());
NativeAd.dowloadandDisplayImage(MirrorNewActivity.this.nativeExitAd.getAdIcon(), nativeAdIcon);
nativeAdMedia.setListener((MediaViewListener) MirrorNewActivity.this.nativeExitAd);
MirrorNewActivity.this.adExitChoicesContainer.addView(new AdChoicesView(MirrorNewActivity.this, MirrorNewActivity.this.nativeExitAd, true));
List<View> clickableViews = new ArrayList<>();
clickableViews.add(nativeAdTitle);
clickableViews.add(nativeAdCallToAction);
MirrorNewActivity.this.nativeExitAd.registerViewForInteraction(MirrorNewActivity.this.nativeAdContainerExitAds, nativeAdMedia, nativeAdIcon, clickableViews);
MirrorNewActivity.this.progressBarExitRefresh.setVisibility(View.GONE);
}
} catch (Exception e) {
MirrorNewActivity.this.nativeAdContainerExitAds.setVisibility(View.INVISIBLE);
}
}