Retrieve and set data from DialogFragment (DatePicker)

前端 未结 4 672
闹比i
闹比i 2020-12-18 12:44

My DialogFragment class is invoked when I press a button on a activity. I want the date set through this DialogFragment to be displayed on the buttons text. FindViewById re

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-18 13:29

    In the method in your DialogFragment that is in charge of being notified when the user sets the date, do this

    Button activityButton = (Button)getActivity().findViewById(R.id.myButton);
    activityButton.setText (myDate);
    

提交回复
热议问题