Android Eclipse Error- Unfortunately <project> has stopped
<p>I'm new here and to android. I looked at the similar topics, but still didn't find the solution.</p>

<p>Here is my xml code..
What I want to do is, on the click of submit button, neither of checkbox is clicked, then produced an error or success message.</p>

<pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
tools:context=".MainActivity" &gt;

&lt;EditText
    android:id="@+id/editText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:ems="10"
    android:hint="Enter Your Name" &gt;

    &lt;requestFocus /&gt;
  &lt;/EditText&gt;



&lt;CheckBox
    android:id="@+id/checkBox3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/checkBox1"
    android:layout_below="@+id/checkBox2"
    android:layout_marginLeft="15dp"
    android:text="Hello" /&gt;

&lt;CheckBox
    android:id="@+id/checkBox4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/checkBox3"
    android:layout_below="@+id/checkBox3"
    android:text="Noon" /&gt;

&lt;CheckBox
    android:id="@+id/checkBox2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/checkBox3"
    android:layout_below="@+id/checkBox1"
    android:text="Evening" /&gt;

&lt;CheckBox
    android:id="@+id/checkBox1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/radioGroup2"
    android:layout_centerVertical="true"
    android:layout_marginLeft="20dp"
    android:checked="true"
    android:text="Morning" /&gt;

&lt;Button
    android:id="@+id/submit"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/checkBox1"
    android:layout_below="@+id/checkBox4"
    android:onClick="onClickSubmit"
    android:text="Hello" /&gt;
</code></pre>

<p></p>

<p>And here is Java code...</p>

<pre><code>CheckBox c1=(CheckBox) findViewById(R.id.checkBox1);
Button sub=(Button) findViewById(R.id.submit);
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);



sub.setOnClickListener(new View.OnClickListener() {  
    public void onClick(View v) {  

                    Toast.makeText(MainActivity.this, "Submit!", Toast.LENGTH_SHORT).show();  
            }  
});  
</code></pre>

<p>Error Log...</p>

<pre><code> 01-19 14:13:47.102: E/AndroidRuntime(2554): FATAL EXCEPTION: main
   01-19 14:13:47.102: E/AndroidRuntime(2554): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.finalfortoday/com.example.finalfortoday.MainActivity}: java.lang.NullPointerException
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.os.Looper.loop(Looper.java:137)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.app.ActivityThread.main(ActivityThread.java:5039)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at java.lang.reflect.Method.invokeNative(Native Method)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at java.lang.reflect.Method.invoke(Method.java:511)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at dalvik.system.NativeStart.main(Native Method)
01-19 14:13:47.102: E/AndroidRuntime(2554): Caused by: java.lang.NullPointerException
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.app.Activity.findViewById(Activity.java:1839)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at com.example.finalfortoday.MainActivity.&lt;init&gt;(MainActivity.java:16)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at java.lang.Class.newInstanceImpl(Native Method)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at java.lang.Class.newInstance(Class.java:1319)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
01-19 14:13:47.102: E/AndroidRuntime(2554):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
01-19 14:13:47.102: E/AndroidRuntime(2554):     ... 11 more
</code></pre>

<p>I've not used anything in Java code yet, still it's giving me error.</p>

<p>Kindly help...</p>
