Q:

Unable to start component info DatePicker

I am working with Tabs and also using multiple activities with single Tab. 
i am facing a problem i.e when i go from parent class to child class that class has datepicker  in it and click on button that shows dialogue of date from where date can b selected. But when i click on that button (that triggers the date dialogue) my application crashes 
when the following 
"Unable to Start component info"
need help to resolve this 
here is subactivity code 
import java.util.Calendar;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
public class PlaceOrder extends Activity {
    private TextView tvDisplayDate,personName,Cname,cAdrress;
    private DatePicker dpResult;
    private Button btnChangeDate;
    Button cancel;
    private int year;
    private int month;
    private int day;
    static final int DATE_DIALOG_ID = 0;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.placeorder);
        personName=(TextView)findViewById(R.id.firstName);
        Cname=(TextView)findViewById(R.id.Cname);
        cAdrress=(TextView)findViewById(R.id.CAddname);
        personName.setText(AccountInfo.fnameNlName);
        Cname.setText(AccountInfo.cName);
        cAdrress.setText(AccountInfo.cAdd);
        setCurrentDateOnView();
        addListenerOnButton();
        cancel=(Button)findViewById(R.id.Cancel);

        cancel.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if(FastPkgMainActivity.fastPackge==1) 
                {
                    Intent fastPkgQuote = new Intent(v.getContext(), FastPkgQuote.class);
                    StringBuffer urlString = new StringBuffer();
                    FastPkgQuote parentActivity = (FastPkgQuote)getParent();
                    parentActivity.replaceContentView("fastpkg1", fastPkgQuote);
                }
                else if(FastPkgMainActivity.fastPackge==2)
                {
                    Intent fastpkgQuoteNew = new Intent(v.getContext(), FastPkgQuoteNew.class);
                    StringBuffer urlString = new StringBuffer();
                    FastPkgQuoteNew parentActivity = (FastPkgQuoteNew)getParent();
                    parentActivity.replaceContentView1("fastPkg2", fastpkgQuoteNew);
                }
            }
        });
    }

    public void setCurrentDateOnView() {
        tvDisplayDate = (TextView) findViewById(R.id.tvDate);
        dpResult = (DatePicker) findViewById(R.id.dpResult);
        dpResult.setVisibility(View.INVISIBLE);
        final Calendar c = Calendar.getInstance();
        year = c.get(Calendar.YEAR);
        month = c.get(Calendar.MONTH);
        day = c.get(Calendar.DAY_OF_MONTH);
        tvDisplayDate.setText(new StringBuilder()
            .append(month + 1).append("-").append(day).append("-").append(year).append(" "));
        dpResult.init(year, month, day, null);
    }

    public void addListenerOnButton() {
        btnChangeDate = (Button) findViewById(R.id.btnChangeDate);
        btnChangeDate.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                showDialog(DATE_DIALOG_ID);
            }
        });
    }

    @Override
    public  Dialog onCreateDialog(int id) {
        switch (id) {
            case DATE_DIALOG_ID:
                return new DatePickerDialog(this, datePickerListener, year, month,day);
        }
        return null;
    }

    public  DatePickerDialog.OnDateSetListener datePickerListener = new 
        DatePickerDialog.OnDateSetListener() {
            public void onDateSet(DatePicker view, int selectedYear,int selectedMonth, int selectedDay) 
            {
                year = selectedYear;
                month = selectedMonth;
                day = selectedDay;
                tvDisplayDate.setText(new StringBuilder().append(month + 1).append("-").append(day).append("-").append(year).append(" "));
                // set selected date into datepicker also
                dpResult.init(year, month, day, null);
            }
        };
    }
}

here is logcat result 
 FATAL EXCEPTION: main

android.view.WindowManager$BadTokenException: 

Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@44ef0838 

is not valid; is your activity running?

android.view.ViewRoot.setView(ViewRoot.java:505)

04-20 15:50:06.703: E/AndroidRuntime(323):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.view.Window$LocalWindowManager.addView(Window.java:424)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.app.Dialog.show(Dialog.java:241)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.app.DatePickerDialog.show(DatePickerDialog.java:129)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.app.Activity.showDialog(Activity.java:2556)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.app.Activity.showDialog(Activity.java:2514)
04-20 15:50:06.703: E/AndroidRuntime(323):  at corrculator.fastPkg.PlaceOrder$3.onClick(PlaceOrder.java:108)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.view.View.performClick(View.java:2408)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.view.View$PerformClick.run(View.java:8816)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.os.Handler.handleCallback(Handler.java:587)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.os.Handler.dispatchMessage(Handler.java:92)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.os.Looper.loop(Looper.java:123)
04-20 15:50:06.703: E/AndroidRuntime(323):  at android.app.ActivityThread.main(ActivityThread.java:4627)
04-20 15:50:06.703: E/AndroidRuntime(323):  at java.lang.reflect.Method.invokeNative(Native Method)
04-20 15:50:06.703: E/AndroidRuntime(323):  at java.lang.reflect.Method.invoke(Method.java:521)
04-20 15:50:06.703: E/AndroidRuntime(323):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-20 15:50:06.703: E/AndroidRuntime(323):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-20 15:50:06.703: E/AndroidRuntime(323):  at dalvik.system.NativeStart.main(Native Method)

A:

I believe the problem could be on this line:
AlertDialog.Builder builder = new AlertDialog.Builder(this);

Try modifying it to:
AlertDialog.Builder builder = new AlertDialog.Builder(MyActivityName.this);

