1
I’m using the lib betterpickers, I tried to make a class to take your information form OO, however the method does not have a return, it is a void, there is a way to catch this return?
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 you on Mainactivity so:
Inflate inflate = new Inflate();
tes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
inflate.piker(getSupportFragmentManager());
}
});
I’ve tried something like onDateSet call 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;
}
However, how would I get that feedback if I’m calling Piker? That’s the problem, is there any way to do it? Because in Activity I have 4 places where a date should be set, if for each one I have to make a different method the code gets huge.
Documentation: https://github.com/code-troopers/android-betterpickers
Post the documentation for us to see.
– rbz
@RBZ ready, added
– Woton Sampaio