问题的日期选择器和timepicker [英] Problem with datepicker and timepicker

查看:163
本文介绍了问题的日期选择器和timepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我就把在同一CLASSE Android开发者的例子code,但我在这个问题

Hi i put the code of the examples in android developers in the same classe but i have a problem in this

@覆盖
            保护对话框onCreateDialog(INT ID){

@Override protected Dialog onCreateDialog(int id) {

            switch (id) {
            case DATE_DIALOG_ID:
                return new DatePickerDialog(this,
                            mDateSetListener,
                            mYear, mMonth, mDay);  

            case TIME_DIALOG_ID:
                return new TimePickerDialog(this,
                        mTimeSetListener, mHour, mMinute, false);
                }
            return null;
        }

为什么我不能做到这一点?

why i can't do this??

它仅适用于一个案例。

推荐答案

宣布参加DATE_DIALOG_ID和TIME_DIALOG_ID静态字段,设置不同的值时。例如。
DATE_DIALOG_ID = 0;
TIME_DIALOG_ID = 1;
这应该解决您的问题。

when declaring static fields for DATE_DIALOG_ID and TIME_DIALOG_ID, set different values. eg. DATE_DIALOG_ID = 0; TIME_DIALOG_ID = 1; This should solve your problem.

这篇关于问题的日期选择器和timepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆