This is part of the code from my AndroidLauncher.
I got it from a tutorial from in the libgdx documentation on using AdMob :
@Override
public void showBannerAd() {
runOnUiThread(new Runnable() {
@Override
public void run() {
bannerAd.setVisibility(View.VISIBLE);
AdRequest.Builder builder = new AdRequest.Builder();
AdRequest ad = builder.build();
bannerAd.loadAd(ad);
}
});
}
First I though runOnUiThread would create e separate thread to handle the adRequest, but when I read up on what
the UI Thread actually is, I read it’s the main thread and it’s the same one that the code for my game would be running on.
If that’s the case then why would that piece of code be in there (can I leave it out)? Or does it maybe has something to do with that when I want to access this method from within my game classes I’m doing that via an interface?