android - My game shows white textures using LIBGDX and AdMob -
i have succefully add , admob ad game. first time load it, , first time, after lock device or go home when open again game textures white rectangles game still running , can hear sounds , actors still working correctly ad showing fine.
pd. discovered happens if open game after installing it. if finish instalation, close installation wizzard(?) , open normaly game problem not happen.
i don´t know whats reason of this.
my code follows:
mainactivity.java
public class mainactivity extends androidapplication { private adview adview; relativelayout layout; view gameview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); androidapplicationconfiguration cfg = new androidapplicationconfiguration(); cfg.usegl20 = false; cfg.useaccelerometer = false; cfg.usecompass = false; // create layout layout = new relativelayout(this); // stuff initialize() requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); getwindow().clearflags(windowmanager.layoutparams.flag_force_not_fullscreen); // create libgdx view gameview = initializeforview(new mygame(), false); // create , setup admob view adview = new adview(this); adview.setadunitid("my id"); adview.setadsize(adsize.banner); adview.setbackgroundcolor(color.transparent); adview.loadad(new adrequest.builder() .build()); // add libgdx view layout.addview(gameview); // add admob view relativelayout.layoutparams adparams = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); adparams.addrule(relativelayout.align_parent_top); adparams.addrule(relativelayout.center_in_parent); //adview.setvisibility(view.visible); layout.addview(adview, adparams); // hook setcontentview(layout); }
manifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.me.prototipo_bombas" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="9" android:targetsdkversion="19" /><application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name=".mainactivity" android:label="@string/app_name" android:screenorientation="landscape" android:configchanges="keyboard|keyboardhidden|orientation|screensize"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.google.android.gms.ads.adactivity" android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|s mallestscreensize" /> </application> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> </manifest>
if lock device or go home sounds still working. after closing game next time open fine. don't know why happens once.
i hope me problem.
libgdx#initialiseforview sets contentview. calling setcontentview again later in oncreate. setcontentview should called once. problem.
Comments
Post a Comment