Take the 2-minute tour ×

I created an activity which is show google map on the screen, and consists of 3 option menus to interact with user selection.

When user press on the sub menu I want to show pop-up input dialog box that user can enter date(dd/mm/yyyy) or pop-up date picker. I will use that date to query the location which kept at that date then mark on the map.

My problem is when I tried to created input dialog or whatever inside my sub menu, nothing show on screen except map view. I think it may have something special to do like this. So, I searched for many days, but still do not get an answer.

Any one have an idea or did this ? Please, suggest me. This is my first time with google map. Appreciate every answer.

share|improve this question
Please let me know if there is anything I can clarify in my answer. :) –  RedBlueThing Jul 20 '11 at 23:44
No problem. Hope you are feeling better :) –  RedBlueThing Jul 22 '11 at 5:50
Sorry for very late response bec I got sick and got the rest since week ago. I will try and tell you later. Thank you so much :) –  Yoo Jul 22 '11 at 6:21
add comment

1 Answer

up vote 1 down vote accepted

Your problem is not specifically with the MapActivity. I have an app that has this feature (a MapActivity subclass that shows a date picker) and haven't had any problems. I suspect the issue lies with how you are showing your date picker. Perhaps try it in an plain activity (ie one that doesn't derive from MapActivity) to confirm this.

So in your class that extends the MapActivity you will need something like:

// the id for your dialog
static final int DATE_DIALOG_ID = 0;
// the date from the picker
Date mDate; 

// so you are defining a member variable mDateSetListener which implements
// onDateSet. This gets called when the user selects a date.
private DatePickerDialog.OnDateSetListener mDateSetListener =
    new DatePickerDialog.OnDateSetListener() {
        public void onDateSet(DatePicker view, int year,
                              int monthOfYear, int dayOfMonth) {

            Calendar cal = GregorianCalendar.getInstance();
            cal.set (year, monthOfYear, dayOfMonth);

            // store the date that was picked
            mDate = cal.getTime();

            // update your map
            // ...

protected android.app.Dialog onCreateDialog(int id) {
   switch (id) {

    case DATE_DIALOG_ID:

        final Calendar c = Calendar.getInstance();

        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH);
        int day = c.get(Calendar.DAY_OF_MONTH);

        return new DatePickerDialog(this,
                year, month, day);
   return null;

@Override public boolean onMenuItemSelected(int featureId, MenuItem item)
        // handle your date selection menu item
        case R.id.date:
share|improve this answer
Could you please explain about DATE_DIALOG_ID and mDateSetListener, where its come from ? and mDate is Date type right ? –  Yoo Jul 22 '11 at 6:27
@Yoo I have updated with those member variables and an explanation of the mDateSetListener. –  RedBlueThing Jul 22 '11 at 6:31
I follow your answer, but nothing display on screen. –  Yoo Jul 22 '11 at 7:20
@Yoo If you set a breakpoint at showDialog, does it reach that point? –  RedBlueThing Jul 22 '11 at 7:29
My mistake occurred at sub menu :)) –  Yoo Jul 26 '11 at 7:07
show 3 more comments

Your Answer


