Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
122 views
in Technique[技术] by (71.8m points)

android - 从DialogFragment调用DatePickerDialog(Calling a DatePickerDialog from a DialogFragment)

This is causing some error.

(这会导致一些错误。)

For the listener, I tried to put TaskPopupDialog.this.getContext() but it still shows error.

(对于侦听器,我尝试放入TaskPopupDialog.this.getContext(),但仍显示错误。)

What would be suitable parameters for the DatePickerDialog class?

(DatePickerDialog类的合适参数是什么?)

Appreciate your help!

(感谢你的帮助!)

public class TaskPopupDialog extends DialogFragment implements ILoad {
    EditText description;
    EditText timeduetext;
    EditText timestamp;
    EditText deliveryfee;
    Button submitbutton, timedueBtn, exitBtn;
    RadioGroup rg;
    int day,month,year,hour,minute,dayFinal,monthFinal,yearFinal,hourFinal,minuteFinal;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.popup, container, false);
        findViewById(v);
        exitBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        timedueBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Calendar c = Calendar.getInstance();
                year = c.get(Calendar.YEAR);
                month = c.get(Calendar.MONTH);
                day = c.get(Calendar.DAY_OF_MONTH);

                **DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), R.style.DialogTheme, getContext(),year,month,day);**
                datePickerDialog.show();
            }
        });

        return v;
    }
  ask by G.L. translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...