Skip to content

Date Picker Dialog

levching edited this page Apr 9, 2020 · 3 revisions

The UM_DatePickerDialog is a simple dialog containing native DatePicker component inside that will allow your app user to pick a date. See the use example below:

    using System;
    using UnityEngine;
    using SA.Android.App;
    ...

    var date = DateTime.Now;
    int year = date.Year;
    int month = date.Month - 1; //Compatibility with Android Calendar..
    int day = date.Day;

    AN_DatePickerDialog picker = new AN_DatePickerDialog(year, month, day);
    picker.Show((result) => {
        if(result.IsSucceeded) {
            Debug.Log("date picked result.Year: "  + result.Year);
            //Same  Android Calendar Compatibility
            Debug.Log("date picked result.Month: " + result.Month + 1);
            Debug.Log("date picked result.Day: " + result.Day);
        } else { 
            Debug.Log("Failed to pick a date: " + result.Error.FullMessage);
        }
    });

Clone this wiki locally