I'm using lib betterpickers , I tried to make a class to get its information in OO form, but the method does not have a return, it's a void, is there a way to get that return? / p>
public class Inflate implements CalendarDatePickerDialogFragment.OnDateSetListener{
private static final String FRAG_TAG_DATE_PICKER = "fragment_date_picker_name";
public void piker(FragmentManager supportFragmentManager){
CalendarDatePickerDialogFragment cdp = new CalendarDatePickerDialogFragment()
.setOnDateSetListener(this);
cdp.show(supportFragmentManager, FRAG_TAG_DATE_PICKER);
}
@Override
public void onDateSet(CalendarDatePickerDialogFragment dialog, int year, int monthOfYear, int dayOfMonth) {
//Esse é o metodo
}
}
I call it in MainActivity like this:
Inflate inflate = new Inflate();
tes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
inflate.piker(getSupportFragmentManager());
}
});
I've already tried something like onDateSet calling another method:
@Override
public void onDateSet(CalendarDatePickerDialogFragment dialog, int year, int monthOfYear, int dayOfMonth) {
getData(year + "/" + monthOfYear + "/" + dayOfMonth);
}
public String getData(String data){
return data;
}
But how would I get this return if I'm calling the piker? That's the problem, is there any way to do it? Because in this activity I have 4 places where a date must be defined, if for each one I have to do a different method the code gets huge.
Documentation: link