我有添加或忽略广告的AdActivity
要求Admob
。我正在使用 aTabActivity
并且在选项卡内导航的活动保存在ArrayList
. 当我导航到选项卡中的第三个活动然后返回时集成广告后,而不是返回上一个活动(在集成广告之前发生),我将退出应用程序。在将活动添加到时,ArrayList
我将意图标志设置为FLAG_ACTIVITY_CLEAR_TOP
. 您能否告诉我如何克服在第 3 次后按时退出应用程序activity
而能够进入第 2 次activity
然后进入第 1 次activity
?
谢谢你。
编辑:
04-10 13:19:32.519: E/AndroidRuntime(1392): FATAL EXCEPTION: main
04-10 13:19:32.519: E/AndroidRuntime(1392): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.admob/com.example.admob.activity.MainTabActivity}: java.lang.NullPointerException
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.os.Handler.dispatchMessage(Handler.java:99)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.os.Looper.loop(Looper.java:137)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-10 13:19:32.519: E/AndroidRuntime(1392): at java.lang.reflect.Method.invokeNative(Native Method)
04-10 13:19:32.519: E/AndroidRuntime(1392): at java.lang.reflect.Method.invoke(Method.java:511)
04-10 13:19:32.519: E/AndroidRuntime(1392): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-10 13:19:32.519: E/AndroidRuntime(1392): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-10 13:19:32.519: E/AndroidRuntime(1392): at dalvik.system.NativeStart.main(Native Method)
04-10 13:19:32.519: E/AndroidRuntime(1392): Caused by: java.lang.NullPointerException
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:101)
04-10 13:19:32.519: E/AndroidRuntime(1392): at com.google.ads.AdView.<init>(SourceFile:87)
04-10 13:19:32.519: E/AndroidRuntime(1392): at com.google.ads.doubleclick.DfpAdView.<init>(SourceFile:27)
04-10 13:19:32.519: E/AndroidRuntime(1392): at com.example.admob.activity.MainTabActivity.onCreate(MainTabActivity.java:80)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.app.Activity.performCreate(Activity.java:4465)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-10 13:19:32.519: E/AndroidRuntime(1392): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
04-10 13:19:32.519: E/AndroidRuntime(1392): ... 11 more