My problem is that I need to be able to show a banner and I am using the StartApp sdk. And the banner is not shown, not only that, it gives me the well-known error the application has been closed.
My layout code:
<com.startapp.android.publish.banner.Banner
android:id="@+id/startAppBanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"/>
And my onCreate () code of the Activity is:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StartAppSDK.init(this, "202753996", true);
StartAppAd.showSplash(this, savedInstanceState);
Banner banner = (com.startapp.android.publish.ads.banner.Banner) findViewById(R.id.startAppBanner);
banner.showBanner();
setContentView(R.layout.activity_de);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
If you know how to solve my problem. Please let me know Thank you
My logcat
03-30 08:19:49.677: E/AndroidRuntime(8111): FATAL EXCEPTION: main
03-30 08:19:49.677: E/AndroidRuntime(8111): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.virtualdisk/com.example.virtualdisk.DE}: java.lang.NullPointerException
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2146)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.app.ActivityThread.access$700(ActivityThread.java:140)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.os.Handler.dispatchMessage(Handler.java:99)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.os.Looper.loop(Looper.java:137)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.app.ActivityThread.main(ActivityThread.java:4944)
03-30 08:19:49.677: E/AndroidRuntime(8111): at java.lang.reflect.Method.invokeNative(Native Method)
03-30 08:19:49.677: E/AndroidRuntime(8111): at java.lang.reflect.Method.invoke(Method.java:511)
03-30 08:19:49.677: E/AndroidRuntime(8111): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
03-30 08:19:49.677: E/AndroidRuntime(8111): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
03-30 08:19:49.677: E/AndroidRuntime(8111): at dalvik.system.NativeStart.main(Native Method)
03-30 08:19:49.677: E/AndroidRuntime(8111): Caused by: java.lang.NullPointerException
03-30 08:19:49.677: E/AndroidRuntime(8111): at com.example.virtualdisk.DE.onCreate(DE.java:60)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.app.Activity.performCreate(Activity.java:5188)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
03-30 08:19:49.677: E/AndroidRuntime(8111): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2085)
03-30 08:19:49.677: E/AndroidRuntime(8111): ... 11 more