I would like to play video ads in my app in a random way when you click a button, but I don’t know if the way i think to do that is correct or not. I was thinking about something like this:
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view ) {
mpButtonClick.start();
clicked++;
text.setText(" " + clicked);
adcompany1.playAd();
adcompany2.playAd();
}
});
}
This is a general case , but I guess that what I would like to do it’s pretty clear. adcompany1 and adcompany2 are two different hypotheticals ad companies. Is this a correct way or not?