APP gives error and stops working on android
<p>I checked the alert.class to find the error, because the logcat file showed an error in starting the alert.class activity, but I can't find any errors.<BR>
Here is the code:</p>

<pre><code>public class alert extends Activity 
{
    Button button1;
    Button button2;

public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.alert);
    button1 = (Button) findViewById(R.id.button1);
    button2 = (Button) findViewById(R.id.button2);

    button1.setOnClickListener(new OnClickListener()
    {
        public void onClick(View v1) 
        { 
        setContentView(R.layout.set);
        Intent myIntent = new Intent(getApplicationContext(), set.class);
        startActivity(myIntent);

        }
    });
    button2.setOnClickListener(new OnClickListener()
    {
        public void onClick(View v1) 
        {
            setContentView(R.layout.set);
            Intent myIntent = new Intent(getApplicationContext(), set.class);
            startActivity(myIntent);
        }
    });
}
</code></pre>

<p>}</p>

<p>this is the logcat:</p>

<pre><code>03-23 08:28:28.239: E/AndroidRuntime(463): FATAL EXCEPTION: main
03-23 08:28:28.239: E/AndroidRuntime(463): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.indianic.demo.calendark/com.indianic.demo.calendark.alert}: java.lang.NullPointerException
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.os.Looper.loop(Looper.java:123)
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.app.ActivityThread.main(ActivityThread.java:3683)
03-23 08:28:28.239: E/AndroidRuntime(463):  at java.lang.reflect.Method.invokeNative(Native Method)
03-23 08:28:28.239: E/AndroidRuntime(463):  at java.lang.reflect.Method.invoke(Method.java:507)
03-23 08:28:28.239: E/AndroidRuntime(463):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-23 08:28:28.239: E/AndroidRuntime(463):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-23 08:28:28.239: E/AndroidRuntime(463):  at dalvik.system.NativeStart.main(Native Method)
03-23 08:28:28.239: E/AndroidRuntime(463): Caused by: java.lang.NullPointerException
03-23 08:28:28.239: E/AndroidRuntime(463):  at com.indianic.demo.calendark.alert.onCreate(alert.java:37)
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-23 08:28:28.239: E/AndroidRuntime(463):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-23 08:28:28.239: E/AndroidRuntime(463):  ... 11 more
</code></pre>
