Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Avocarrot code
private void displayNativeAd(List<CustomModel> ads) {
final CustomModel ad = ads.get(0);
adHeadlineView.setText(ad.getTitle());
adBodyTextView.setText(ad.getDescription());
adCallToAction.setText(ad.getCTAText());
// Load the advertisement's creative into your ImageView
avocarrotCustom.loadImage(ad, adIcon);
if (!ad.getTitle().equals(previousAdHeadline)) {
previousAdHeadline = ad.getTitle().toString();
avocarrotCustom.bindView(ad, adView);
// Set click listener
adCallToAction.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
avocarrotCustom.handleClick(ad);
}
});
}
if (isActivityRunning) {
new CountDownTimer(5000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
avocarrotCustom.loadAd();
}
}.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.