Я пробовал и admob, и mobfox.Однако в списке активности нет рекламы.
RelativeLayout adslayout;
adapter = new ArrayAdapter<String>(this,R.layout.listlayout,R.id.txtmesajlar , messages);
mobfoxView = new MobFoxView(this, publisherId, true, true);
setListAdapter(adapter);
adslayout = (RelativeLayout)findViewById(R.id.adslayout);
adslayout.addView(mobfoxView);
Из Logcat: Исключением является java lang NullPointerException.
Когда я пробовал те же коды в своей другой деятельности, я помещал mobfoxview в linearlayout иРекламный баннер успешно добавлен.Listactivity игнорирует рекламу или есть какая-то ошибка от меня?
listlayout.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/adslayout" android:layout_width="fill_parent" android:layout_gravity="center"></RelativeLayout>
<TextView android:layout_height="wrap_content" android:id="@+id/txtmesajlar" android:layout_width="fill_parent" android:textColor="@color/White" android:textSize="18sp" android:textStyle="bold" android:drawingCacheQuality="auto" android:drawableLeft="@drawable/listenvelop"></TextView>
</LinearLayout>
LOGCAT
08-25 12:11:59.925: ОШИБКА / AndroidRuntime (887): ИСКЛЮЧИТЕЛЬНОЕ ИСКЛЮЧЕНИЕ: основное 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): java.lang.RuntimeException: Невозможно запустить действие ComponentInfo {com.mc.bayrammesajlari / com.mc.bayrammesajlari.BayramActivity}: java.lang.NullPointerException 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): в android.app.ActivityThread.performLaunchActivity (ActivityThread.java:1647) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): в android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:1663) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): в android.app.ActivityThread.access $ 1500 (ActivityThread.java: 117) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): на android.app.ActivityThread $ H.handleMessage (ActivityThread.java:931) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime(887): на android.os.Handler.dispatchMessage (Handler.java: 99) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): на android.os.Looper.loop (Looper.java:123) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): at android.app.ActivityThread.main (ActivityThread.java:3683) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): на java.lang.reflect.Method.invokeNative (собственный метод) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): на java.lang.reflect.Method.invoke (Method.java:507) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): на com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:839) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): в com.android.internal.os.ZygoteInit.main (ZygoteInit.java:597) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): at dalvik.system.NativeStart.main (собственный метод) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): вызвано: java.lang.NullPointerException 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): на com.mc.bayrammesajlari.BayramActivity.onCreate (BayramActivity.java:52) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887):в android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1047) 08-25 12: 11: 59.925: ОШИБКА / AndroidRuntime (887): в android.app.ActivityThread.performLaunchActivity (ActivityThread.java:1611)
Большое спасибо.