此代码不起作用。我检查了displayLanguage值。值是正确的(displayLanguage="Türkçe")。但它不起作用。
private void setAdvertisement()
{
Locale _locale = Locale.getDefault();
String displayLanguage = _locale.getDisplayLanguage();
if(displayLanguage == "Türkçe")
{
// Create the adView
adView = new AdView(this, AdSize.BANNER, "My Admob ID");
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="@+id/mainLayout"
// Add the adView to it
linearLayoutAdvertisement.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
}
}
但是这段代码工作正常:
private void setAdvertisement()
{
// Create the adView
adView = new AdView(this, AdSize.BANNER, "My Admob ID");
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="@+id/mainLayout"
// Add the adView to it
linearLayoutAdvertisement.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
}
我不明白问题是什么。