Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen applying Theme to activity I get a nullpointer exception
    text
    copied!<p>Hi I am new to Android development, I'm trying to set a activity's theme by including the theme in activity : <code>&lt;activity android:name="AddEventActivity" android:theme="@android:style/Theme.Dialog"&gt;&lt;/activity&gt;</code></p> <p>When running the application I get the following exception :</p> <pre><code> 07-23 13:00:34.965: E/AndroidRuntime(3599): FATAL EXCEPTION: main 07-23 13:00:34.965: E/AndroidRuntime(3599): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sadev.z/com.sadev.z.AddEventActivity}: java.lang.NullPointerException 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.app.ActivityThread.access$600(ActivityThread.java:140) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.os.Handler.dispatchMessage(Handler.java:99) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.os.Looper.loop(Looper.java:137) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.app.ActivityThread.main(ActivityThread.java:4898) 07-23 13:00:34.965: E/AndroidRuntime(3599): at java.lang.reflect.Method.invokeNative(Native Method) 07-23 13:00:34.965: E/AndroidRuntime(3599): at java.lang.reflect.Method.invoke(Method.java:511) 07-23 13:00:34.965: E/AndroidRuntime(3599): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) 07-23 13:00:34.965: E/AndroidRuntime(3599): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) 07-23 13:00:34.965: E/AndroidRuntime(3599): at dalvik.system.NativeStart.main(Native Method) 07-23 13:00:34.965: E/AndroidRuntime(3599): Caused by: java.lang.NullPointerException 07-23 13:00:34.965: E/AndroidRuntime(3599): at com.sadev.z.AddEventActivity.onCreate(AddEventActivity.java:87) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.app.Activity.performCreate(Activity.java:5206) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083) 07-23 13:00:34.965: E/AndroidRuntime(3599): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064) 07-23 13:00:34.965: E/AndroidRuntime(3599): ... 11 more </code></pre> <p>When I remove the code from the AndroidManifest.xml it works.</p> <p>What I want to do is display an Activity like a Dialog by using a theme.</p> <p>Is android:theme="@android:style/Theme.Dialog" a standard theme witch is included automatically in my project or should I add it, and where? or what am I doing wrong?</p> <p>Any help will be appreciated. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload