0

i am doing an application based on alarm manager, i have to set multiple time picker in CUSTOM DIALOG BOX ,

i just created custom dialog box and dynamically displaying multiple buttons using spinner .

i am getting an error at

protected Dialog onCreateDialog(int id) {
                    switch (id) {
                    case TIME_DIALOG_ID:
                        return new TimePickerDialog(this, timeListener, hours, min,
                                false);
                    }
                    return null;
                }
            }

error is at (int id) Syntax error on token ")", ; expected

i am enable to solve this and sugest me to do multple time pickers.

Anwesh
  • 91
  • 1
  • 1
  • 12
  • Do for time pickers on this link- http://stackoverflow.com/questions/3734981/multiple-datepickers-in-same-activity – AkashG Jul 10 '12 at 07:04

1 Answers1

2

You have to declare more than one constant if u want repeat the dialog.like this

private static final int TIME_DIALOG_ID = 0;
    private static final int TIME_DIALOG_ID1 = 1;

@Override
    public Dialog onCreateDialog(int id) {
        switch (id) {


        case TIME_DIALOG_ID:
            return new TimePickerDialog(this,mTimeSetListener, 0, 0, false);


    case TIME_DIALOG_ID1:
        return new TimePickerDialog(this,mTimeSetListener, 0, 0, false);

    }

        return null;

}

& then on button click Listner jst call it like that on diffrent buttons

showDialog(TIME_DIALOG_ID);
showDialog(TIME_DIALOG_ID1);
Amandeep singh
  • 1,865
  • 7
  • 21
  • 41