Admob ad not visible on Android Emulator
Try this solution:
AdView adView = new AdView(getApplicationContext());//in menu inflater getActivity()
adView.setAdUnitId("ca-app-pub-87***yourNumber");
adView.setAdSize(AdSize.BANNER);
LinearLayout linLay = (LinearLayout)findViewById(R.id.idReklamaLayout);
// Add the adView to it
linLay.addView(adView);
// Initiate a generic request to load it with an ad
if(Build.MANUFACTURER.equals("unknown")) {
// Emulator
AdRequest.Builder.addTestDevice("B3EEABB8EE11C2BE770B684D95219ECB"); // to get test ads on this device.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // All emulators
.addTestDevice("B3EEABB8EE11C2BE770B684D95219ECB") // Emulator id you will get in the LogCat verbose
.build();
adView.loadAd(adRequest);
/* */
}else {
// Not Emulator
// Initiate a generic request to load it with an ad
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);/**/
}
396LW NO topic_id
AD
Další témata ....(Topics)
ACRA allows your Android application to send Crash Reports to various destinations:
a Google Docs spreadsheet (default and original behavior)
an email
your own server-side HTTP POST script
any other possible destination by implementing your own report sender
ACRA wiki and download page of project library
a Google Docs spreadsheet (default and original behavior)
an email
your own server-side HTTP POST script
any other possible destination by implementing your own report sender
ACRA wiki and download page of project library
R.string.app_name to String example.
MyActivity.java
res/values/string.xml
MyActivity.java
Resources res = getResources();
String sText = res.getString(R.string.app_name);
res/values/string.xml
<resources>
<string name="app_name">My app name</string>
</resources>
HashMap<String,Locale> _mapOfLocale = new HashMap<String,Locale>();
_mapOfLocale.put("French",Locale. FRENCH );
_mapOfLocale.put("German",Locale. GERMAN );
_mapOfLocale.put("Italian",Locale. ITALIAN );
for (Entry<String, Locale> entry : _mapOfLocale.entrySet()) {
System.out.println(entry.getKey());
System.out.println(entry.getValue());
}
break statement in Java Android basic example
MainClass.java
MainClass.java
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = {"nothing", "Hello", "people"
, "bye-bye", "hello", "world!", "end" };
for (int i = 0; i < arrayOfString.length; i++) {
System.out.println(arrayOfString[i]);
if(i > 2)
break; // end of loop
}
}
}
/*
nothing
Hello
people
bye-bye
*/
Cut, shear, clip, snip, crop a bitmap, picture, image Android example
public class ApokusActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new SampleView(this));
}
private static class SampleView extends View {
// CONSTRUCTOR
public SampleView(Context context) {
super(context);
setFocusable(true);
}
@Override
protected void onDraw(Canvas canvas) {
Paint paint = new Paint();
canvas.drawColor(Color.YELLOW);
// you need to insert a image flower_blue into res/drawable folder
paint.setFilterBitmap(true);
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
R.drawable.flower_blue);
Bitmap croppedBmp = Bitmap.createBitmap(bitmapOrg, 0, 0,
bitmapOrg.getWidth() / 2, bitmapOrg.getHeight());
int h = bitmapOrg.getHeight();
canvas.drawBitmap(bitmapOrg, 10, 10, paint);
canvas.drawBitmap(croppedBmp, 10, 10 + h + 10, paint);
}
}
}
Editace: 2015-01-14 19:08:07
Počet článků v kategorii: 396
Url:admob-ad-not-visible-on-android-emulator