Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
127 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...