Why am I getting ' setAdListener must be called on the main UI thread' when I am running it on the UI thread
<p>I am trying to add interstitial ads to my game. It is built on a framework from a book. The constructor is:</p>

<pre><code> public GameScreen(Game game) {
        super(game);
        world = new World();
        clueLetters = new String[10];
        levelNo = SettingsObject.levelUnlock;
        getWord();
        interstitialAd = new InterstitialAd(AndroidGame.context);
        interstitialAd.setAdUnitId("ca-app-pub-1861496496821617/");

        //Create an ad request
        AdRequest.Builder adRequestBuilder = new AdRequest.Builder();

        AndroidGame.activityReference.runOnUiThread(new Runnable() {
            @Override
            public void run()

            {
                // Set AdListener
                interstitialAd.setAdListener(new AdListener() {
                    @Override
                    public void onAdClosed() {
                        super.onAdClosed();
                    }
                });
            }
        });

        Looper.prepare();
        interstitialAd.loadAd(adRequestBuilder.build());

    }
</code></pre>

<p>However, I get the error:</p>

<pre><code> java.lang.IllegalStateException: setAdListener must be called on the main UI thread.
</code></pre>

<p>Can you tell me why I am getting that error and how to fix it, please?</p>