dewinjm / monthyear-picker

Month and Year picker library for Android
Apache License 2.0
35 stars 14 forks source link

How to adjust title to display month and year selected #3

Closed CodingRookie97 closed 6 years ago

CodingRookie97 commented 6 years ago

How to adjust the month and year selected when the current month and year shown is Sep 2018 as the title still displays Aug 2018.

dewinjm commented 6 years ago

Hi!

For the moment, the title is constructed by the month and year established in the creation of the instance.

MonthYearPickerDialogFragment.getInstance(monthSelected, yearSelected)

I'll add a method to customize the title, I'll let you know when it's ready.

dewinjm commented 6 years ago

If you want to customize the title, update to the latest version.

Add the value to the title parameter in the getInstance method:

int yearSelected; // year selected to show
int monthSelected; // month selected to show
String customTitle; // your custom title, if it is null, it will set the month-year selected as the title

MonthYearPickerDialogFragment
                .getInstance(monthSelected, yearSelected, customTitle);