Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ protected void onDestroy() {
private void addBannerAds() {
// Loop through the items array and place a new banner ad in every ith position in
// the items List.

// Using < instead of <= prevents the loop from accessing an index equal to the size of the list, avoiding IndexOutOfBoundsException by staying within the list's bounds.
// for (int i = 0; i < recyclerViewItems.size(); i += ITEMS_PER_AD) {

for (int i = 0; i <= recyclerViewItems.size(); i += ITEMS_PER_AD) {
final AdView adView = new AdView(MainActivity.this);
adView.setAdSize(AdSize.BANNER);
Expand Down