Use of MIDP Advanced UI (iv) Alert

Source: Internet
Author: User
Tags define time interval

This class is interesting, it is used to remind users about errors or other unusual circumstances of the screen object, this warning can only as a short message record and reminder, if we need a bit longer, we can use the other screens subclass, the most common is the form. And by the way we mention a class AlertType related to it, it's important to remind the reader that AlertType is a tool class that itself cannot be instantiated. (That is, we can't produce concrete objects like form.)

There are 5 types of AlertType: ALARM (Alert), Confirmation (OK), error (Error), info (information hint), WARNING (warning).

Alert is a special screen object that, when invoked in the Setcurrent () method, emits a warning sound before it appears on the screen, and after a while it automatically jumps back to the previous screen.

What we need to be aware of is that we have to define the screen that it can bounce back before using setcurrent () to display alert, otherwise an exception will occur.

In alert we can use the settimeout () method to set the interval time, SetType () to invoke several of the above mentioned types, setimage () to define the picture, setstring () to define the text, and through the GetType (), GetImage (), getString () to obtain the corresponding object.

You can use settimeout () to define the time that alert () displays, and when alert displays the time interval we specify on the screen, it jumps back to the screen object we specified, or back to the previous screen. If we call settimeout () and pass in the Alert.forveer as a parameter, the screen will always display this alert unless the user presses the specified key. If there is only one command in a timed alert, the command activates automatically when the timeout occurs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.