android - androidannotations + mopub null pointer exception -
did 1 use androidannotations + mopub? i'm getting null pointer exception in runtime. seems view can't found. here's listings , stacktrace
settings.java
package com.nbrk.rates; import android.os.bundle; import android.support.v4.app.navutils; import com.actionbarsherlock.app.sherlockpreferenceactivity; import com.googlecode.androidannotations.annotations.*; import com.mopub.mobileads.mopubview; /** * created intellij idea. * user: rpagyc * date: 17.12.12 * time: 3:12 * change template use file | settings | file templates. */ @eactivity(r.layout.admob_preference) public class settings extends sherlockpreferenceactivity { @viewbyid(r.id.adview) mopubview adview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); addpreferencesfromresource(r.xml.app_prefs_cat1); } @afterviews public void init() { getsupportactionbar().setdisplayhomeasupenabled(true); adview.setadunitid("d1124826a1664353bd0c723561b1be34"); adview.loadad(); } }
admob_preference.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center"> <com.mopub.mobileads.mopubview android:id="@+id/adview" android:layout_width="fill_parent" android:layout_height="50dp" /> <listview android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent"/> </linearlayout>
stacktrace
08-16 05:36:10.954: error/androidruntime(2190): fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{com.nbrk.rates/com.nbrk.rates.settings_}: java.lang.nullpointerexception @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) @ android.app.activitythread.access$600(activitythread.java:141) @ android.app.activitythread$h.handlemessage(activitythread.java:1234) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5039) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) @ dalvik.system.nativestart.main(native method) caused by: java.lang.nullpointerexception @ com.nbrk.rates.settings.init(settings.java:34) @ com.nbrk.rates.settings_.aftersetcontentview_(settings_.java:34) @ com.nbrk.rates.settings_.setcontentview(settings_.java:40) @ android.preference.preferenceactivity.oncreate(preferenceactivity.java:510) @ com.nbrk.rates.settings.oncreate(settings.java:25) @ com.nbrk.rates.settings_.oncreate(settings_.java:26) @ android.app.activity.performcreate(activity.java:5104) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1080) @ android.app.activitythread.performlaunchactivity(activitythread.java:2144) ... 11 more
are sure code executed up-to-date ? line 34 seems }
.
Comments
Post a Comment