I\'m following this tutorial to show cards and integrate Tinder-like swipe feature.
In-between the cards
I want to show ads and for that I\'m using
If you know the cards to be put from before then what you can do is 1. create a card stack 2. put first two non-add-cards 3. Then make a random test if it has to put a add-card for third else put the non-add-card. 4. do this card put with test till 7 cards.
Example:
boolean atLeastOneAddPut = false;
int count = 1;
for(Data data: DataArray){
if(count > 2 && count < 8 && shouldPutAdd()){
mSwipeView.add(new AddView());
count++;
}
mSwipeView.add(new NonAddView(data));
count++;
}
private boolean shouldPutAdd(){
//generate random 0 and 1
int random;
...
return random == 1;
}