0
첫 번째 앱을 끝내고 몇 가지 광고를 추가하려고했습니다. Google에서 제공하는 자습서를 사용해 보았지만 정상적으로 작동합니다. 이제 응용 프로그램에서 add를 구현하려고하면 오류 메시지가 나타납니다. "IllegalStateException : 기본 UI 스레드에서 isLoaded를 호출해야합니다". 그래서 여기Android의 삽입 광고
내가 내 주요 활동에 무슨 짓을 난에서 onCreate 방법이 : 같은 활동에
public void onCreate(){
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId(MY_AD_UNIT_ID);
// Create ad request.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("xxxxxxxxxxxxxx")
.build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
}
을 나는이 : 그래서
public void showInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
을 나는 showInterstitial 메소드를 호출 할 때 위에서 설명한 오류가 나타납니다. 저는 몇 시간 동안이 문제에 착석했습니다. 해결책을 찾을 수 없습니다.