ForceClose error when i try to execute the application
<p>I am new to android, as part of the learning process i am trying to write an app, it was working
upto one stage then i got force close error. So i removed all code modifications i made but still the error is repeating. I am posting the logcat below - cant seem to make any sense out of it myself
I would really appreciate any help. If u need any more details please notify.</p>

<pre><code>07-11 11:34:39.938: ERROR/Zygote(33): setreuid() failed. errno: 2
07-11 11:34:45.898: ERROR/Zygote(33): setreuid() failed. errno: 17
07-11 11:34:46.888: ERROR/BatteryService(59): usbOnlinePath not found
07-11 11:34:46.888: ERROR/BatteryService(59): batteryVoltagePath not found
07-11 11:34:46.888: ERROR/BatteryService(59): batteryTemperaturePath not found
07-11 11:34:46.909: ERROR/SurfaceFlinger(59): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
07-11 11:34:51.398: ERROR/EventHub(59): could not get driver version for /dev/input/mouse0, Not a typewriter
07-11 11:34:51.398: ERROR/EventHub(59): could not get driver version for /dev/input/mice, Not a typewriter
07-11 11:34:51.628: ERROR/System(59): Failure starting core service
07-11 11:34:51.628: ERROR/System(59): java.lang.SecurityException
07-11 11:34:51.628: ERROR/System(59):     at android.os.BinderProxy.transact(Native Method)
07-11 11:34:51.628: ERROR/System(59):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
07-11 11:34:51.628: ERROR/System(59):     at android.os.ServiceManager.addService(ServiceManager.java:72)
07-11 11:34:51.628: ERROR/System(59):     at com.android.server.ServerThread.run(SystemServer.java:184)
07-11 11:34:52.298: ERROR/SoundPool(59): error loading /system/media/audio/ui/Effect_Tick.ogg
07-11 11:34:52.298: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressStandard.ogg
07-11 11:34:52.298: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressSpacebar.ogg
07-11 11:34:52.298: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressDelete.ogg
07-11 11:34:52.309: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressReturn.ogg
07-11 11:34:53.968: ERROR/ThrottleService(59): Could not open GPS configuration file /etc/gps.conf
07-11 11:34:54.699: ERROR/logwrapper(139): executing /system/bin/tc failed: No such file or directory
07-11 11:34:54.758: ERROR/logwrapper(141): executing /system/bin/tc failed: No such file or directory
07-11 11:34:54.809: ERROR/logwrapper(143): executing /system/bin/tc failed: No such file or directory
07-11 11:35:03.234: ERROR/HierarchicalStateMachine(59): TetherMaster - unhandledMessage: msg.what=3
07-11 11:35:25.931: ERROR/AndroidRuntime(281): FATAL EXCEPTION: main
07-11 11:35:25.931: ERROR/AndroidRuntime(281): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.commsware.android.test05/com.commsware.android.test05.PGTrackerActivity}: java.lang.NullPointerException
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.os.Looper.loop(Looper.java:123)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at java.lang.reflect.Method.invokeNative(Native Method)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at java.lang.reflect.Method.invoke(Method.java:521)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at dalvik.system.NativeStart.main(Native Method)
07-11 11:35:25.931: ERROR/AndroidRuntime(281): Caused by: java.lang.NullPointerException
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at com.commsware.android.test05.PGTrackerActivity.onCreate(PGTrackerActivity.java:107)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-11 11:35:25.931: ERROR/AndroidRuntime(281):     ... 11 more
07-11 11:36:23.461: ERROR/ThrottleService(59): Error reading data file
</code></pre>

<p>and this is the <code>PGTrackerActivity</code> class </p>

<pre><code>package com.commsware.android.test05;

 import java.util.Calendar;

 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.DatePickerDialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.View;
 import android.widget.Button;
 import android.widget.DatePicker;
 import android.widget.TextView;

public class PGTrackerActivity extends Activity 
{
/** Called when the activity is first created. */
SharedPreferences prefs;
Calendar c=Calendar.getInstance();
Calendar tempDate;
TextView tv1,tv2;
Menu theMenu;
LayoutInflater li;

DatePickerDialog.OnDateSetListener d=new DatePickerDialog.OnDateSetListener()
{
    //@override
    public void onDateSet(DatePicker view, int year, int monthOfYear,int dayOfMonth)
    {
        c.set(Calendar.DATE,dayOfMonth);
        c.set(Calendar.MONTH,monthOfYear);
        c.set(Calendar.YEAR,year);
        if(checkValidity())
        {
            SharedPreferences.Editor editor=prefs.edit();
            //set the flag that indicates concieved_date has been added
            editor.putBoolean("concieved_date", true); 

            int datepref;  
            datepref=c.get(Calendar.DATE);
            datepref=datepref*1000000;
            datepref+=c.get(Calendar.MONTH)*10000;
            datepref+=c.get(Calendar.YEAR);
            editor.putInt("date",datepref);
            editor.commit();
            setContentView(R.layout.main);
            setData();
        }
    }
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
  //check if concieved date is set from the prefs file "app_data"
    //if yes open application page else open initial message screen to set the date
    prefs=getApplicationContext().getSharedPreferences("app_data",Context.MODE_APPEND);
    if(prefs.getBoolean("concieved_date", false))
    {

        setContentView(R.layout.main);
        setData();
        Button btn1=(Button)findViewById(R.id.setfalse);
        btn1.setOnClickListener(new View.OnClickListener() 
        {               
            public void onClick(View v) 
            {
                SharedPreferences.Editor editor=prefs.edit();
                editor.putBoolean("concieved_date", false);
                editor.commit();
            }
        });


    }
    else
    {
        setContentView(R.layout.initial_msg);

        //click listener for textview 2
        TextView tv1=(TextView)findViewById(R.id.init_msg);
        tv1.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {
                SharedPreferences.Editor editor=prefs.edit();
                editor.putBoolean("concieved_date", true);
                editor.commit();

                new DatePickerDialog(PGTrackerActivity.this,d,
                        c.get(Calendar.YEAR),
                        c.get(Calendar.MONTH),
                        c.get(Calendar.DAY_OF_MONTH)).show();
            }
        });
    }

    //Listener for the weekly_tip text view
    //when clicked open the layout giving the full description
    TextView tv2=(TextView)findViewById(R.id.weekly_tip);
    tv2.setOnClickListener(new View.OnClickListener() 
    {
        @Override
        public void onClick(View v) 
        {
            Intent j=new Intent(PGTrackerActivity.this,weekly.class);
            startActivity(j);
            //setContentView(R.layout.weekly_description);
        }
    });

    //Listener for open_remainders button to switch to Remainders page
    Button btn2=(Button)findViewById(R.id.open_remainders);
    btn2.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View v) 
        {
            Intent i=new Intent(PGTrackerActivity.this,RemaindersPage.class);
            startActivity(i);
        }
    });
}

void setData()
{
    Long sec,tempSec;
    int date,day,month,year;
    date=prefs.getInt("date", 10101010);
    day=date/1000000;
    date=date%1000000;
    month=date/10000;
    date=date%10000;
    year=date;
    c.set(year, month, day);
    tempDate=c;

    //insert value to concieved_date textfield
    tv1=(TextView)findViewById(R.id.concieved_date);
    tv1.setText(android.text.format.DateFormat.format("dd MMM yyyy", tempDate));

    //insert value to delivery_date
    tv1=(TextView)findViewById(R.id.delivery_date);
    tempDate.add(Calendar.DATE, 280);
    tv1.setText(android.text.format.DateFormat.format("dd MMM yyyy", tempDate));

    //insert value to days_to_delivery
    tv1=(TextView)findViewById(R.id.days_to_delivery);
    c=Calendar.getInstance();  //c has current date
    sec=tempDate.getTimeInMillis()-c.getTimeInMillis();  //find diff in millisecs
    sec=sec/86400000;
    tv1.setText(sec.toString());

    //insert value for days_into_pregnancy
    tv1=(TextView)findViewById(R.id.days_into_pregnancy);
    tempSec=280-sec;
    tv1.setText(tempSec.toString());

    //insert value for current_week
    tv1=(TextView)findViewById(R.id.current_week);
    tempSec=tempSec/7;
    tv1.setText(tempSec.toString());
}

//user method to check the date validity : check if date entered is a reasonable value
boolean checkValidity()
{
    Long duration;
    tempDate=Calendar.getInstance(); //get today's date in c

    //check if user date is on or before today's date
    if(tempDate.before(c)) 
    {
        AlertDialog.Builder ad=new AlertDialog.Builder(this);
        ad.setMessage("Specified date should be on or before today's date");
        ad.setNeutralButton("OK",new DialogInterface.OnClickListener()
                {
                    public void onClick(DialogInterface arg0,int arg1){}
                }
        );
        ad.show();
        return false;
    }
    //check if diff between user date and todays date is more than 280 days
    duration=tempDate.getTimeInMillis()-c.getTimeInMillis();
    duration/=86400000;
    if(duration&gt;280)
    {
        AlertDialog.Builder ad=new AlertDialog.Builder(this);
        ad.setMessage("Specified date can be atmost 280 days before today's date");
        ad.setNeutralButton("OK",new DialogInterface.OnClickListener()
                {
                    public void onClick(DialogInterface arg0,int arg1){}
                }
        ).show();
        return false;
    }
    return true;    
}
</code></pre>

<p>}</p>
