Unable to call objects from XML in application

In my application, I don't seem to be able to call any of the layout objects in my application. the application will crash if i access any class that includes code which is using the XML file. lines like this \[code\]mButton = (Button)findViewById(R.id.get);cweight = (EditText)findViewById(R.id.cweight);nweight = (EditText)findViewById(R.id.nweight);t = (TextView)findViewById(R.id.out);\[/code\]These lines of code have worked before and the layout files they are called exist. the logcat for this is below and looking at it i cannot see where the problem came from. specially since this code works days before. \[code\]05-23 16:12:43.790: E/AndroidRuntime(313): FATAL EXCEPTION: main05-23 16:12:43.790: E/AndroidRuntime(313): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.b00348312.workout/com.b00348312.workout.WorkoutChoice}: java.lang.NullPointerException05-23 16:12:43.790: E/AndroidRuntime(313): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)05-23 16:12:43.790: E/AndroidRuntime(313): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)05-23 16:12:43.790: E/AndroidRuntime(313): at android.app.ActivityThread.access$2300(ActivityThread.java:125)05-23 16:12:43.790: E/AndroidRuntime(313): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)05-23 16:12:43.790: E/AndroidRuntime(313): at android.os.Handler.dispatchMessage(Handler.java:99)05-23 16:12:43.790: E/AndroidRuntime(313): at android.os.Looper.loop(Looper.java:123)05-23 16:12:43.790: E/AndroidRuntime(313): at android.app.ActivityThread.main(ActivityThread.java:4627)05-23 16:12:43.790: E/AndroidRuntime(313): at java.lang.reflect.Method.invokeNative(Native Method)05-23 16:12:43.790: E/AndroidRuntime(313): at java.lang.reflect.Method.invoke(Method.java:521)05-23 16:12:43.790: E/AndroidRuntime(313): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)05-23 16:12:43.790: E/AndroidRuntime(313): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)05-23 16:12:43.790: E/AndroidRuntime(313): at dalvik.system.NativeStart.main(Native Method)05-23 16:12:43.790: E/AndroidRuntime(313): Caused by: java.lang.NullPointerException05-23 16:12:43.790: E/AndroidRuntime(313): at com.b00348312.workout.WorkoutChoice.onCreate(WorkoutChoice.java:67)05-23 16:12:43.790: E/AndroidRuntime(313): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)05-23 16:12:43.790: E/AndroidRuntime(313): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)05-23 16:12:43.790: E/AndroidRuntime(313): ... 11 more\[/code\]ok so looking through solutions given the consensus seems to be that its the null pointer exception on line 67 but that is the first line i have given above. another solutions given is to use the setContent(view view) which i have done at the beginning on my onCreate method. the class works perfectly fine when the lines given above are absent and they have worked before so i am not sure where the problem is.
 
Back
Top