以下是我的代码
startBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showTimePickerDialog(view);
}
});
endBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showTimePickerDialog(view);
}
});
public void showTimePickerDialog(View v) {
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getFragmentManager(), "timePicker");
}
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String time = String.format("%02d", hourOfDay) + ":" + String.format("%02d", minute);
Log.d("DTAG", "Time Selected:" + time);
//How to know here what button triggered the new fragment
}
如何在不在函数外部设置新值的情况下知道button
触发了操作的内容?与startBtnClicked=true;