CN104572110A - Optimizing method of Toast activeX in android system - Google Patents
Optimizing method of Toast activeX in android system Download PDFInfo
- Publication number
- CN104572110A CN104572110A CN201510026242.2A CN201510026242A CN104572110A CN 104572110 A CN104572110 A CN 104572110A CN 201510026242 A CN201510026242 A CN 201510026242A CN 104572110 A CN104572110 A CN 104572110A
- Authority
- CN
- China
- Prior art keywords
- toast
- display interface
- activity display
- current activity
- information prompting
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- User Interface Of Digital Computer (AREA)
Abstract
The invention relates to an optimizing method of a Toast activeX in an android system. The method comprises the steps of setting monitoring functions in notification manager service of an INotification manager interface; calling the monitoring functions; monitoring whether the operation is switched to the current Activity display interface at the time T in the current Activity display interface; if so, closing a Toast information prompt box; if not so, automatically closing the Toast information prompt box after reaching the time X. According to the optimizing method, the delay of the Toast information prompt box can be avoided during displaying in the application program through the optimized Toast active, and therefore, the user experience is increased; the workload in development and the repeated codes in the program can be decreased, and the operation speed is increased.
Description
Technical field
The present invention relates to the optimization method of Toast control on a kind of Android system, belong to multimedia technology field.
Technical background
Along with the development of science and technology, various electronic equipment has increasing function, such as mobile phone, panel computer, intelligent television, brings better experience to user.In these intelligent electronic devices, 80% adopts Android system.
Toast is one message notifying frame very easily on Android system, and it can show a simple information on program interface, and this information prompting frame is used for generating simple information to user.Focus can not be obtained during Toast information, automatically can disappear after a while after its prompting message and (in Toast class, have two static constant: LONG_DELAY=3.5S, SHORT_DELAY=2S, when constructing Toast object, user can select in these two constants one as displaying time).
Because the quantity of information of prompting on Toast is general all fewer, user just gets information in a short period of time, but Toast can not obtain focus again and user can not turn off the Toast finished watching, this time will be many on the screen of the electronic device an otiose black box (default color of Toast information frame is black), have impact on Consumer's Experience.More seriously, if when being provided with multiple Toast control on an Activity, and user operation is than time very fast, adopting consecutive click chemical reaction repeatedly screen creates multiple Toast, because each Toast has certain displaying time, the Toast not respective user operation now of display now will be produced this time.A kind of situation is also had to be exactly, after current Activity exits, also can continue to show the Toast produced in this Activity.
These problems more than occurred, application developer solves by a large amount of judgement codes the Toast that screen shows on stream and now operates not corresponding problem with user: the static method makeText () calling Toast class, setting wants the time of display reminding information and display to be LONG or SHORT, then show () method is called, display Toast object; This Toast object, after the displaying time of setting arrives, can be closed automatically; If create multiple Toast on this Activity, be empty first to the variable assignments of Toast type, then when calling Toast object, whether detect Toast object is empty, if be empty, then call static method makeText (), otherwise, call setText () method and upgrade information.But this solution adds the workload of application developer exploitation and a large amount of duplicated codes, travelling speed is slack-off, and user experience is not high.
Summary of the invention
For the deficiencies in the prior art, the invention discloses the optimization method of Toast control on a kind of Android system;
The present invention, when listening to the operation of the Activity display interface that current Activity display interface has switching current, closes Toast information prompting frame.
Technical scheme of the present invention is:
An optimization method for Toast control on Android system, in the notice management service class NotificationManagerService of INotificationManager interface, arrange monitoring function, concrete steps comprise:
(1) static method makeText (the Context context of Toast class is called, CharSequence text, intduration), to parameter context, text, duration assignment respectively: context environmental context assignment is current Activity display interface, text assignment is the content of Toast information prompting frame display, and duration assignment is the time T of Toast information prompting frame display;
(2) call show () method, show the Toast information prompting frame on current Activity display interface;
(3) monitoring function is called, monitor the operation whether current Activity display interface having in time T and switches current Activity display interface, if had, then close Toast information prompting frame, otherwise, after time T arrives, automatically close Toast information prompting frame.
Preferred according to the present invention, the operation of the Activity display interface that described switching is current is included on current Activity display interface has the click action of the current Activity display interface content of renewal and click return key to enter the operation of an Activity display interface.
Preferred according to the present invention, the monitoring function that ACTION_DOWN and KEYCODE_BACK action on current Activity display interface is monitored is increased in notice management service class NotificationManagerService, ACTION_DOWN represents the click action having on current Activity display interface and upgrade current Activity display interface content, and KEYCODE_BACK represents click the operation that return key enters an Activity display interface on current Activity display interface.
Preferred according to the present invention, in step (3), described closedown Toast information prompting frame, specifically refers to: realize in object in BroadcastReceiver class, call the hide () method of Toast object, close Toast information prompting frame.
Preferred according to the present invention, in step (3), described automatic closedown Toast information prompting frame, specifically refers to: call the cancel () function in Toast class, automatically closes Toast information prompting frame.
Static method makeText (the Context context of INotificationManager interface, notice management service class NotificationManagerService, Toast class, CharSequence text, int duration), show () method, monitoring function, BroadcastReceiver class, the hide () method monitored ACTION_DOWN and KEYCODE_BACK action, cancel () function is all existing designs.
Beneficial effect of the present invention is:
Compared with the implementation method of the Toast control in existing Android system, the Toast control after being optimized by the present invention, when showing Toast information prompting frame in the application, be there will not be the delay of Toast information prompting frame, improves Consumer's Experience; For application developer, the Toast control after the present invention optimizes, decreases the duplicated code in their development amount and program, adds travelling speed.
Accompanying drawing explanation
Fig. 1 is the optimization method process flow diagram of Toast control on Android system of the present invention.
Embodiment
Below in conjunction with Figure of description and embodiment, the present invention is further qualified, but is not limited thereto.
Embodiment 1
An optimization method for Toast control on Android system, in the notice management service class NotificationManagerService of INotificationManager interface, arrange monitoring function, concrete steps comprise:
(1) static method makeText (the Context context of Toast class is called, CharSequence text, intduration), to parameter context, text, duration assignment respectively: context environmental context assignment is current Activity display interface, text assignment is the content of Toast information prompting frame display, and duration assignment is the time T of Toast information prompting frame display;
(2) call show () method, show the Toast information prompting frame on current Activity display interface;
(3) monitoring function is called, monitor the operation whether current Activity display interface having in time T and switches current Activity display interface, if had, then close Toast information prompting frame, otherwise, after time T arrives, automatically close Toast information prompting frame.
The operation of the Activity display interface that described switching is current is included on current Activity display interface has the click action of the current Activity display interface content of renewal and click return key to enter the operation of an Activity display interface.
Embodiment 2
Optimization method according to embodiment 1, its difference is, the monitoring function that ACTION_DOWN and KEYCODE_BACK action on current Activity display interface is monitored is increased in notice management service NotificationManagerService, ACTION_DOWN represents the click action having on current Activity display interface and upgrade current Activity display interface content, and KEYCODE_BACK represents click the operation that return key enters an Activity display interface on current Activity display interface.
Embodiment 3
Optimization method according to embodiment 1, its difference is, in step (3), described closedown Toast information prompting frame, specifically refer to: realize in object in BroadcastReceiver class, call the hide () method of Toast object, close Toast information prompting frame.
Embodiment 4
According to the arbitrary described optimization method of embodiment 1-3, its difference is, in step (3), and described automatic closedown Toast information prompting frame, specifically refer to: call the cancel () function in Toast class, automatically close Toast information prompting frame.
Claims (5)
1. the optimization method of Toast control on Android system, it is characterized in that, in the notice management service class NotificationManagerService of INotificationManager interface, arrange monitoring function, concrete steps comprise:
(1) static method makeText (the Context context of Toast class is called, CharSequence text, intduration), to parameter context, text, duration assignment respectively: context environmental context assignment is current Activity display interface, text assignment is the content of Toast information prompting frame display, and duration assignment is the time T of Toast information prompting frame display;
(2) call show () method, show the Toast information prompting frame on current Activity display interface;
(3) monitoring function is called, monitor the operation whether current Activity display interface having in time T and switches current Activity display interface, if had, then close Toast information prompting frame, otherwise, after time T arrives, automatically close Toast information prompting frame.
2. optimization method according to claim 1, it is characterized in that, the operation of the Activity display interface that described switching is current is included on current Activity display interface has the click action of the current Activity display interface content of renewal and click return key to enter the operation of an Activity display interface.
3. optimization method according to claim 1, is characterized in that, in notice management service class
Increase in NotificationManagerService ACTION_DOWN on current Activity display interface and
The monitoring function monitored is carried out in KEYCODE_BACK action, ACTION_DOWN represents the click action having on current Activity display interface and upgrade current Activity display interface content, and KEYCODE_BACK represents click the operation that return key enters an Activity display interface on current Activity display interface.
4. optimization method according to claim 1, it is characterized in that, in step (3), described closedown Toast information prompting frame, specifically refer to: realize in object in BroadcastReceiver class, call the hide () method of Toast object, close Toast information prompting frame.
5. according to the arbitrary described optimization method of claim 1-4, it is characterized in that, in step (3), described automatic closedown Toast information prompting frame, specifically refer to: call the cancel () function in Toast class, automatically close Toast information prompting frame.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510026242.2A CN104572110A (en) | 2015-01-19 | 2015-01-19 | Optimizing method of Toast activeX in android system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510026242.2A CN104572110A (en) | 2015-01-19 | 2015-01-19 | Optimizing method of Toast activeX in android system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104572110A true CN104572110A (en) | 2015-04-29 |
Family
ID=53088276
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510026242.2A Pending CN104572110A (en) | 2015-01-19 | 2015-01-19 | Optimizing method of Toast activeX in android system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104572110A (en) |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105898020A (en) * | 2015-12-15 | 2016-08-24 | 乐视移动智能信息技术(北京)有限公司 | Mobile phone replacing method and device |
CN106383712A (en) * | 2016-09-21 | 2017-02-08 | 武汉斗鱼网络科技有限公司 | Toast component realization method and system |
CN106445533A (en) * | 2016-09-28 | 2017-02-22 | 北京金山安全软件有限公司 | Toast display method and device and electronic equipment |
CN106569798A (en) * | 2016-10-13 | 2017-04-19 | 上海斐讯数据通信技术有限公司 | Android system Toast information control method and system |
CN106941568A (en) * | 2017-03-30 | 2017-07-11 | 努比亚技术有限公司 | A kind of Toast pop-ups optimization display methods, device and Toast pop-ups dispatching method and device |
CN107179906A (en) * | 2017-04-11 | 2017-09-19 | 山东大学 | A kind of method of Android system TickerView controls optimization |
WO2017157186A1 (en) * | 2016-03-16 | 2017-09-21 | 阿里巴巴集团控股有限公司 | Android-based pop-up prompt method and device |
CN107766109A (en) * | 2017-09-22 | 2018-03-06 | 广州小鹏汽车科技有限公司 | A kind of methods of exhibiting, the apparatus and system of Android system bubble control |
CN110018813A (en) * | 2018-01-10 | 2019-07-16 | 武汉斗鱼网络科技有限公司 | A kind of Toast design method, storage medium, electronic equipment and system |
CN110280018A (en) * | 2019-06-21 | 2019-09-27 | 努比亚技术有限公司 | Interface processing method, terminal and computer readable storage medium |
WO2020064000A1 (en) * | 2018-09-30 | 2020-04-02 | 中兴通讯股份有限公司 | Method and apparatus for displaying message box, terminal and storage medium |
CN112199078A (en) * | 2020-11-10 | 2021-01-08 | 平安普惠企业管理有限公司 | Toast message pushing method and device based on android fragment component and computer equipment |
CN114201134A (en) * | 2022-02-17 | 2022-03-18 | 北京麟卓信息科技有限公司 | Optimized display method of Toast in multi-window mode in android compatible environment |
CN114201318A (en) * | 2022-02-17 | 2022-03-18 | 北京麟卓信息科技有限公司 | Display method of Toast in multi-window mode in android compatible environment |
CN116088714A (en) * | 2022-05-26 | 2023-05-09 | 荣耀终端有限公司 | Message prompt box processing method and related device |
CN117176794A (en) * | 2023-09-13 | 2023-12-05 | 上海卓悠网络科技有限公司 | Unified message pushing method and system based on Android system and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100295797A1 (en) * | 2009-05-21 | 2010-11-25 | Sony Computer Entertainment America Inc. | Continuous and dynamic scene decomposition for user interface |
CN101950236A (en) * | 2010-09-06 | 2011-01-19 | 宇龙计算机通信科技(深圳)有限公司 | Method for processing message, device and mobile terminal thereof |
CN103095923A (en) * | 2013-01-22 | 2013-05-08 | 广东欧珀移动通信有限公司 | Short message display method of mobile communication terminal |
-
2015
- 2015-01-19 CN CN201510026242.2A patent/CN104572110A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100295797A1 (en) * | 2009-05-21 | 2010-11-25 | Sony Computer Entertainment America Inc. | Continuous and dynamic scene decomposition for user interface |
CN101950236A (en) * | 2010-09-06 | 2011-01-19 | 宇龙计算机通信科技(深圳)有限公司 | Method for processing message, device and mobile terminal thereof |
CN103095923A (en) * | 2013-01-22 | 2013-05-08 | 广东欧珀移动通信有限公司 | Short message display method of mobile communication terminal |
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105898020A (en) * | 2015-12-15 | 2016-08-24 | 乐视移动智能信息技术(北京)有限公司 | Mobile phone replacing method and device |
US10678564B2 (en) | 2016-03-16 | 2020-06-09 | Alibaba Group Holding Limited | Android-based pop-up prompt method and device |
WO2017157186A1 (en) * | 2016-03-16 | 2017-09-21 | 阿里巴巴集团控股有限公司 | Android-based pop-up prompt method and device |
US10853102B2 (en) | 2016-03-16 | 2020-12-01 | Advanced New Technologies Co., Ltd. | Android-based pop-up prompt method and device |
CN106383712A (en) * | 2016-09-21 | 2017-02-08 | 武汉斗鱼网络科技有限公司 | Toast component realization method and system |
CN106445533A (en) * | 2016-09-28 | 2017-02-22 | 北京金山安全软件有限公司 | Toast display method and device and electronic equipment |
CN106569798A (en) * | 2016-10-13 | 2017-04-19 | 上海斐讯数据通信技术有限公司 | Android system Toast information control method and system |
CN106941568A (en) * | 2017-03-30 | 2017-07-11 | 努比亚技术有限公司 | A kind of Toast pop-ups optimization display methods, device and Toast pop-ups dispatching method and device |
CN107179906A (en) * | 2017-04-11 | 2017-09-19 | 山东大学 | A kind of method of Android system TickerView controls optimization |
CN107179906B (en) * | 2017-04-11 | 2020-05-29 | 山东大学 | Method for optimizing TickerView control of android system |
CN107766109A (en) * | 2017-09-22 | 2018-03-06 | 广州小鹏汽车科技有限公司 | A kind of methods of exhibiting, the apparatus and system of Android system bubble control |
CN110018813A (en) * | 2018-01-10 | 2019-07-16 | 武汉斗鱼网络科技有限公司 | A kind of Toast design method, storage medium, electronic equipment and system |
WO2020064000A1 (en) * | 2018-09-30 | 2020-04-02 | 中兴通讯股份有限公司 | Method and apparatus for displaying message box, terminal and storage medium |
CN110280018A (en) * | 2019-06-21 | 2019-09-27 | 努比亚技术有限公司 | Interface processing method, terminal and computer readable storage medium |
CN112199078A (en) * | 2020-11-10 | 2021-01-08 | 平安普惠企业管理有限公司 | Toast message pushing method and device based on android fragment component and computer equipment |
CN114201134A (en) * | 2022-02-17 | 2022-03-18 | 北京麟卓信息科技有限公司 | Optimized display method of Toast in multi-window mode in android compatible environment |
CN114201318A (en) * | 2022-02-17 | 2022-03-18 | 北京麟卓信息科技有限公司 | Display method of Toast in multi-window mode in android compatible environment |
CN114201134B (en) * | 2022-02-17 | 2022-04-29 | 北京麟卓信息科技有限公司 | Optimized display method of Toast in multi-window mode in android compatible environment |
CN116088714A (en) * | 2022-05-26 | 2023-05-09 | 荣耀终端有限公司 | Message prompt box processing method and related device |
CN116088714B (en) * | 2022-05-26 | 2024-05-28 | 荣耀终端有限公司 | Message prompt box processing method and related device |
CN117176794A (en) * | 2023-09-13 | 2023-12-05 | 上海卓悠网络科技有限公司 | Unified message pushing method and system based on Android system and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104572110A (en) | Optimizing method of Toast activeX in android system | |
EP2993584B1 (en) | Method and device for controlling background application | |
CN108008888B (en) | Method and device for rapidly switching application program and interface thereof | |
CN103984532B (en) | A kind of mobile terminal function arranges position method to set up and the device of key | |
CN106528028B (en) | Information processing method, system, device and terminal | |
CN106201409B (en) | Processing method and system for application program operation interface | |
CN104461724A (en) | Method and device for controlling split screens of terminal | |
CN105682148A (en) | Traffic sharing method and system | |
CN104780185A (en) | Information sharing control method and device | |
CN104133610A (en) | Screen-splitting interaction method of mobile terminal and mobile terminal | |
CN105677265A (en) | Display method and terminal | |
CN104571926A (en) | Touch method and touch device | |
WO2016101526A1 (en) | Display method and device for terminal screen, and computer storage medium | |
CN103634682A (en) | Global setting implementation method and device for intelligent televisions | |
WO2015131669A1 (en) | Application control method, apparatus, terminal and computer storage medium | |
CN104125345A (en) | Mode switching method and device | |
CN105575390A (en) | Voice control method and device | |
CN103701996A (en) | Quick opening and closing method for application program notification of mobile terminal | |
CN105704758A (en) | Method and device of closing social applications based on flow monitoring | |
CN105101138A (en) | Method and system for controlling traffic, and terminal | |
CN111813308A (en) | Interface processing method and device, electronic equipment and storage medium | |
CN105100851A (en) | Intelligent television remote controller operation instruction method and device | |
CN112188001A (en) | Shortcut setting method, shortcut setting device and electronic equipment | |
CN112148168A (en) | Icon moving method and device and electronic equipment | |
CN112099702A (en) | Application running method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20150429 |