java - Restrict button from being clicked based on the time of the day ANDROID -
I need to restrict a button by clicking on the time of day in my Android app. For example, I do not need to order the app after 9 o'clock, so I want to disable the button after that time. I have seen it in and seen "time now = new time ();" After a method that says that there is an input of time. I tried 900, 9: 00 and 9 .00, no luck, do anyone know how this can be done?
My experience with the timing of the link is a little limited, so I'm not sure there are better ways to exist, But how do I do it This can also be done with the Java API But if you need to work with dates / etc. You can start using the add-on. This will be disabled from will be disabled from this code inside
DateTime now = DateTime.now (); If (now.Gethofed ()> = 21) {System.out.println ("Disable it."); } Else {System.out.println ("Enable it."); }
calendar calendar = calendar.forest (); If (calendar.get (calendar.HOUR_OF_DAY) & gt; = 21) {System.out.println ("it is dysfunctional."); } Else {System.out.println ("Enable it."); }
0 - 21 ,
21 - 23
OnResume
Comments
Post a Comment