Search code examples
clockapp-inventor

Any action at a specific time (MIT App Inventor)


I am making an application in MIT App Inventor, and I do not know how to do one thing.

For example:

If - time between (11:00AM-01:00PM) - set label.text to (it lunch time)

I do not know how to do it, do any action if is time from - to.


Solution

  • Write your own custom procedure: use aClock component together with the Clock.FormatDate method and the pattern kkmm to get the time in a format like HHMM, see screenshot.

    For a list of different patterns to use, see here https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

    enter image description here

    A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks. There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
    How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

    Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor