App crashing with new layout design-Collection of common programming errors

As I was designing my program I realized that my layout was not going to work. So I decide to create a new layout, but when I add the layout to my setcontentview, My application crashes. When I switch back to the old layout it runs fine. Can someone tell me what I did wrong.





/** A1 */

    
    

/** A2 */

    
    

/** A3 */

    
    

/** A4 */

    
    

/** B1 */

    
    
       
/** B2 */

    
    

/** B3 */

    
    

/** B4 */

    
    


Did I forget to do something??????????

Update*

Error Log:

12-02 14:32:41.537: D/AndroidRuntime(362): Shutting down VM 12-02 14:32:41.537: W/dalvikvm(362): threadid=1: thread exiting with uncaught exception (group=0x40014760) 12-02 14:32:41.588: D/dalvikvm(362): GC_CONCURRENT freed 76K, 3% free 6620K/6791K, paused 7ms+3ms 12-02 14:32:41.588: E/AndroidRuntime(362): FATAL EXCEPTION: main 12-02 14:32:41.588: E/AndroidRuntime(362): java.lang.RuntimeException: Unable to start activity ComponentInfo{test.tablet.design/test.tablet.design.MainActivity}: java.lang.NullPointerException 12-02 14:32:41.588: E/AndroidRuntime(362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736) 12-02 14:32:41.588: E/AndroidRuntime(362): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752) 1> 2-02 14:32:41.588: E/AndroidRuntime(362): at android.app.ActivityThread.access$1500(ActivityThread.java:123) 12-02 14:32:41.588: E/AndroidRuntime(362): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993) 12-02 14:32:41.588: E/AndroidRuntime(362): at android.os.Handler.dispatchMessage(Handler.java:99) 12-02 14:32:41.588: E/AndroidRuntime(362): at android.os.Looper.loop(Looper.java:126) 12-02 14:32:41.588: E/AndroidRuntime(362): at android.app.ActivityThread.main(ActivityThread.java:3997) 12-02 14:32:41.588: E/AndroidRuntime(362): at java.lang.reflect.Method.invokeNative(Native Method) 12-02 14:32:41.588: E/AndroidRuntime(362): at java.lang.reflect.Method.invoke(Method.java:491) 12-02 14:32:41.588: E/AndroidRuntime(362): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) 12-02 14:32:41.588: E/AndroidRuntime(362): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) 12-02 14:32:41.588: E/AndroidRuntime(362): at dalvik.system.NativeStart.main(Native Method) 12-02 14:32:41.588: E/AndroidRuntime(362): Caused by: java.lang.NullPointerException 12-02 14:32:41.588: E/AndroidRuntime(362): at test.tablet.design.MainActivity.onCreate(MainActivity.java:31) 12-02 14:32:41.588: E/AndroidRuntime(362): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048) 12-02 14:32:41.588: E/AndroidRuntime(362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700) 12-02 14:32:41.588: E/AndroidRuntime(362): … 11 more

Good Layout































  1. Check MainActivity.java:31 I think you’re looking for a view by name, and you’re using different IDs in each layout. Whatever is on the line that gets your NullPointerException will give you a clue.