CN112199078A - Toast message pushing method and device based on android fragment component and computer equipment - Google Patents

Toast message pushing method and device based on android fragment component and computer equipment Download PDF

Info

Publication number
CN112199078A
CN112199078A CN202011246207.9A CN202011246207A CN112199078A CN 112199078 A CN112199078 A CN 112199078A CN 202011246207 A CN202011246207 A CN 202011246207A CN 112199078 A CN112199078 A CN 112199078A
Authority
CN
China
Prior art keywords
component
toast
fragment
message
information
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
Application number
CN202011246207.9A
Other languages
Chinese (zh)
Inventor
赵程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011246207.9A priority Critical patent/CN112199078A/en
Publication of CN112199078A publication Critical patent/CN112199078A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Abstract

The invention discloses a Toast message pushing method and device based on an android fragment component, computer equipment and a storage medium, and relates to a message research and development framework, wherein the message research and development framework comprises the steps of obtaining local current context information and obtaining a message component type corresponding to the current context information; if the message component type corresponding to the current context information is an Activity component, automatically adding a Fragment component as a Toast component; if the message component type corresponding to the current context information is a Fragment component, establishing association between the Fragment component and the Activity component so as to take the Fragment component as a Toast component; if the current user operation information meets the prompt triggering condition, generating prompt information corresponding to the current user operation information, and filling the prompt information into a Toast component; and popping up and displaying the Toast component filled with the prompt message. According to the method, after the APP notification permission is closed on the intelligent terminal provided with the android system, the message can be pushed based on the Toast of the Fragment component, and a user is ensured to receive the notification message in time.

Description

Toast message pushing method and device based on android fragment component and computer equipment
Technical Field
The invention relates to the technical field of message research and development frameworks of research and development management, in particular to a Toast message pushing method and device based on an android fragment component, computer equipment and a storage medium.
Background
The Toast component is a light prompt component which is most commonly used in Android (namely an Android system) application development, is usually used for operation prompt of some users, is simple and quick, and does not influence actual operation of the users.
However, in the Android, there is a case that after the version of the Android 6, the Toast component is brought into the notification queue, which causes that the Toast component cannot be correctly displayed when some users close the APP notification authority, which affects normal pop-up display of information that should be immediately displayed to notify the users (which is actually the case that the information notifying the users cannot pop-up), and causes that the users cannot timely receive notification information with high timeliness requirements.
For example, when the user opens a login page of an APP (i.e., an application) to log in at the intelligent terminal, a password error is input, but the user closes the notification permission of the APP, so that the Toast component cannot be popped up, a prompt of the user for a password error in time cannot be given, and the situation that the user clicks a login button and does not respond all the time occurs.
Disclosure of Invention
The embodiment of the invention provides a method, a device, computer equipment and a storage medium for pushing Toast messages based on an android fragment component, and aims to solve the problem that in the prior art, after an APP notification permission is closed on an intelligent terminal carrying an android system, the Toast component cannot immediately display information notifying a user because the Toast component is brought into a notification queue, and the user cannot timely receive notification information with high timeliness requirements.
In a first aspect, an embodiment of the present invention provides a method for pushing a Toast message based on an android fragment component, including:
acquiring local current context information, and acquiring a message component type corresponding to the current context information; wherein the message component types comprise an Activity component and a Fragment component;
if the message component type corresponding to the current context information is an Activity component, automatically adding a Fragment component as a Toast component;
if the message component type corresponding to the current context information is a Fragment component, establishing association between the Fragment component and an Activity component so as to use the Fragment component as a Toast component;
judging whether the current user operation information meets a prompt triggering condition;
if the current user operation information meets a prompt triggering condition, generating prompt information corresponding to the current user operation information, and filling the prompt information into a Toast component; and
and popping up and displaying the Toast component filled with the prompt message.
In a second aspect, an embodiment of the present invention provides an Toast message pushing apparatus based on an android fragment component, including:
the message component type acquiring unit is used for acquiring local current context information and acquiring a message component type corresponding to the current context information; wherein the message component types comprise an Activity component and a Fragment component;
a first Toast component creating unit, configured to automatically add a Fragment component as a Toast component if the message component type corresponding to the current context information is an Activity component;
a second Toast component creating unit, configured to, if the message component type corresponding to the current context information is a Fragment component, associate the Fragment component with an Activity component, so as to use the Fragment component as a Toast component;
the prompt trigger judging unit is used for judging whether the current user operation information meets a prompt trigger condition;
a prompt information generating unit, configured to generate prompt information corresponding to the current user operation information if the current user operation information meets a prompt trigger condition, and fill the prompt information in a Toast component; and
and the prompt information display unit is used for popping up and displaying the Toast assembly filled with the prompt information.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor, when executing the computer program, implements the method for pushing an Toast message based on an android fragmented component according to the first aspect.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, causes the processor to execute the method for pushing the Toast message based on the android fragment component according to the first aspect.
The embodiment of the invention provides a Toast message pushing method, a Toast message pushing device, a computer device and a storage medium based on an android fragment component, wherein the Toast message pushing method comprises the steps of obtaining local current context information and obtaining a message component type corresponding to the current context information; if the message component type corresponding to the current context information is an Activity component, automatically adding a Fragment component as a Toast component; if the message component type corresponding to the current context information is a Fragment component, establishing association between the Fragment component and an Activity component so as to use the Fragment component as a Toast component; judging whether the current user operation information meets a prompt triggering condition; if the current user operation information meets a prompt triggering condition, generating prompt information corresponding to the current user operation information, and filling the prompt information into a Toast component; and popping up and displaying the Toast component filled with the prompt message. According to the method, after the APP notification permission is closed on the intelligent terminal provided with the android system, the message can be pushed based on the Toast of the Fragment component, and a user is ensured to receive the notification message in time.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a Toast message pushing method based on an android fragment component according to an embodiment of the present invention;
fig. 2 is a schematic block diagram of an android fragment component-based Toast message pushing apparatus according to an embodiment of the present invention;
FIG. 3 is a schematic block diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1, fig. 1 is a schematic flow diagram of a Toast message pushing method based on an android fragmented component according to an embodiment of the present invention, where the Toast message pushing method based on the android fragmented component is applied to an intelligent terminal, and the method is executed through application software installed in the intelligent terminal.
As shown in fig. 1, the method includes steps S110 to S160.
S110, obtaining local current context information, and obtaining a message component type corresponding to the current context information; wherein the message component types include an Activity component and a Fragment component.
In this embodiment, in order to determine whether the local area of the intelligent terminal has the message pushing function of the Toast component, at this time, local current context information needs to be obtained first. The Context information (i.e., Context class) in the Android-equipped intelligent terminal is an interface to global information of the application environment, and is also an abstract class (provided by the Android system) that allows access to application-specific resources and classes, and calls to application-level operations, such as start-up activities, broadcast and reception intents, etc. The Context (i.e., Context class) is a core function class that maintains normal operation of each component of the Android program, and the core function class is equivalent to a large environment, and only in this environment, resources of the Android can be acquired and each component of the Android can be called.
The Activity component is one of four major components of an android system (the four major components of the android system are the Activity component, the Service component, the BroadCast component and the ContentProvider component), and the main function is to provide an interface and interact with a user. Activities have their own 7 life cycles, and there is no close association between activities of a program, which is needed for interaction.
The Fragment component is a new concept from android3.0, and means fragmentation. Fragment is Activity dependent and cannot exist independently. A Fragment component is a UI Fragment that can be embedded in an Activity component, and is used for building a local module of an Activity interface. It can also be said that an Activity interface can be composed of multiple fragments, which behave very similar to Activity, have their corresponding layout (containing specific views), have their lifecycle, receive their input events, and can be added or removed from the active in operation. A Fragment must always be embedded in an Activity, while the lifecycle of a Fragment is affected by the Activity.
And S120, if the message component type corresponding to the current context information is an Activity component, automatically adding a Fragment component as a Toast component.
In this embodiment, if the message component type corresponding to the current context information of the intelligent terminal is an Activity component, a Fragment component may be directly and automatically added to serve as a Toast component, that is, the Fragment component is embedded into the Activity component to serve as the Activity component.
In one embodiment, step S120 includes:
judging whether the Activity component is added with a Fragment component labeled as FToast;
if the Activity component is added with a Fragment component labeled as FToast, displaying the Fragment component;
if the Activity component does not add a Fragment component labeled FToast, a Fragment component is automatically added to serve as a Toast component.
In this embodiment, when adding a Fragment component to an Activity component as a Toast component, first determining whether the current Activity component has added a Fragment component labeled "FToast" once, if so, directly displaying the Fragment component, and updating the corresponding text content; if the Fragment component labeled "FToast" is not added, a Fragment component is directly added as the Toast component.
Because the Android pages are all composed of Activity/Fragment, Fragment can be loaded on more than any two pages. Whether the Android X or the traditional support package is adopted, the display and hiding of fragments can be supported.
And Fragment has the same life cycle as Activity, when the page changes, Toast can change at any time and change along with the change of the page, so that memory leakage does not exist, and the code performance is optimized. The Fragment component is not managed by the notification queue of the android system any more, is not influenced by the setting of the user, and can correctly display the Toast component at the time needing displaying.
In one embodiment, the automatically adding a Fragment component as a Toast component includes:
adding Fragment components to the layout of the Activity component in a tag form to obtain the Toast component.
In this embodiment, when adding a Fragment component to an Activity component, a static registration mode may be adopted, that is, the Fragment component is added to the layout of the Activity component in a tag form to obtain a Toast component, and this addition mode is more rapid.
In specific implementation, a dynamic registration mode can be adopted, namely, the Fragment component is added into the existing host Activity component through Java code, and the adding mode can ensure rapidness.
S130, if the type of the message component corresponding to the current context information is a Fragment component, establishing association between the Fragment component and the Activity component so as to use the Fragment component as a Toast component.
In this embodiment, if the message component type corresponding to the current context information is a Fragment component, the Activity component hosted by the Fragment component may be obtained, and then the Fragment component and the Activity component are associated to serve as the Toast component, and then only the time of the Toast component needs to be updated, and the text needs to be refreshed.
And S140, judging whether the current user operation information meets a prompt triggering condition.
In this embodiment, after a Fragment component is added locally to the intelligent terminal to serve as a Toast component, it needs to be detected whether current user operation information corresponding to the current operation of the user meets a prompt trigger condition. For example, when the account and the password currently input by the user fail to pass the verification of the server, it may be considered that a prompt trigger condition is triggered, and at this time, a pop-up prompt should be timely performed on the intelligent terminal.
S150, if the current user operation information meets a prompt triggering condition, generating prompt information corresponding to the current user operation information, and filling the prompt information into a Toast component.
In this embodiment, if the current user operation information meets the prompt triggering condition, it indicates that the prompt information needs to be displayed in a pop-up window form through the Toast component in time. At this time, in order to prompt an event more accurately, it is necessary to determine an event type (for example, a user login event) according to the current user operation, acquire a processing result (for example, login failure) fed back by the server in response to the user operation determination event, generate corresponding prompt information according to the event type and the processing result (for example, the generated prompt information indicates that the user account fails to be verified, the user fails to login, and the user is asked to re-input a login account number and a password), and fill the prompt information in the Toast component.
And S160, popping up and displaying the Toast component filled with the prompt message.
In this embodiment, after the prompt information is filled in the local Toast component of the intelligent terminal, the Toast component filled with the prompt information is popped up and displayed, so as to prompt the user to perform corresponding operation according to the prompt information in time. And because the carrier of the Toast is Fragment, the Toast with any style in the application can be realized, and the required Toast can be flexibly defined according to the requirement.
In an embodiment, step S110 is followed by:
and acquiring the current system time.
In this embodiment, while obtaining the message component type corresponding to the current context information, it is also required to obtain the current system time, so as to be used as a time reference point for the subsequent calculation of when to hide the Fragment component.
In an embodiment, step S160 is followed by:
acquiring and judging whether the time difference between the current latest system time and the current system time exceeds a preset time threshold value or not;
and if the time difference between the current latest system time and the current system exceeds the time threshold, switching the Fragment component to a hidden state.
In this embodiment, the purpose of obtaining and determining whether the time difference between the current latest system time and the current system time exceeds a preset time threshold is to accurately determine whether the Fragment component needs to be switched to the hidden state at the time corresponding to the current latest system time. For example, if the set time threshold is 1800ms, hiding the Fragment component correspondingly added if the time difference between the current latest system time and the current system exceeds 1800ms, and waiting for the next time when the Fragment component needs to be displayed, and using the Fragment component as the Toast component push message.
In an embodiment, the step S150 further includes:
judging whether the Activity component comprises a plurality of Toast components;
if the Activity component comprises a plurality of Toast components and one Toast component transmits information to another target Toast component, transmitting the information to be transmitted to the Activity component;
and sending the information to be transmitted to the target Toast component through the Bundle file of the Activity component.
In this embodiment, if the Activity component in the local of the intelligent terminal includes a plurality of Toast components, the Activity component is used as an intermediate carrier during communication between the Toast components. One Toast component transmits information to another target Toast component, the information flow direction is Fragment- > Activity- > Fragment, because a plurality of Fragment components are attached to the same Activity component, the information to be transmitted can be transmitted to the target Toast component by transmitting the value to the commonly attached Activity components and then transmitting the information to be transmitted to the target Toast component through a Bundle file of the Activity components (the Bundle file is an executable file and is used for transmitting data between activities of Android).
According to the method, after the APP notification permission is closed on the intelligent terminal provided with the android system, the message can be pushed based on the Toast of the Fragment component, and a user is ensured to receive the notification message in time.
The embodiment of the invention also provides a Toast message pushing device based on the android fragment component, which is used for executing any embodiment of the Toast message pushing method based on the android fragment component. Specifically, referring to fig. 2, fig. 2 is a schematic block diagram of an android fragment component-based Toast message pushing apparatus according to an embodiment of the present invention. The Toast message pushing device 100 based on the android fragment component can be configured in an intelligent terminal, and the intelligent terminal is a terminal such as a smart phone and a tablet computer during specific implementation.
As shown in fig. 2, the Toast message pushing apparatus 100 based on the android fragment component includes: a message component type obtaining unit 110, a first Toast component creating unit 120, a second Toast component creating unit 130, a prompt trigger judging unit 140, a prompt information generating unit 150, and a prompt information displaying unit 160.
A message component type obtaining unit 110, configured to obtain local current context information, and obtain a message component type corresponding to the current context information; wherein the message component types include an Activity component and a Fragment component.
In this embodiment, in order to determine whether the local area of the intelligent terminal has the message pushing function of the Toast component, at this time, local current context information needs to be obtained first. The Context information (i.e., Context class) in the Android-equipped intelligent terminal is an interface to global information of the application environment, and is also an abstract class (provided by the Android system) that allows access to application-specific resources and classes, and calls to application-level operations, such as start-up activities, broadcast and reception intents, etc. The Context (i.e., Context class) is a core function class that maintains normal operation of each component of the Android program, and the core function class is equivalent to a large environment, and only in this environment, resources of the Android can be acquired and each component of the Android can be called.
The Activity component is one of four major components of an android system (the four major components of the android system are the Activity component, the Service component, the BroadCast component and the ContentProvider component), and the main function is to provide an interface and interact with a user. Activities have their own 7 life cycles, and there is no close association between activities of a program, which is needed for interaction.
The Fragment component is a new concept from android3.0, and means fragmentation. Fragment is Activity dependent and cannot exist independently. A Fragment component is a UI Fragment that can be embedded in an Activity component, and is used for building a local module of an Activity interface. It can also be said that an Activity interface can be composed of multiple fragments, which behave very similar to Activity, have their corresponding layout (containing specific views), have their lifecycle, receive their input events, and can be added or removed from the active in operation. A Fragment must always be embedded in an Activity, while the lifecycle of a Fragment is affected by the Activity.
A first Toast component creating unit 120, configured to, if the message component type corresponding to the current context information is an Activity component, automatically add a Fragment component as a Toast component.
In this embodiment, if the message component type corresponding to the current context information of the intelligent terminal is an Activity component, a Fragment component may be directly and automatically added to serve as a Toast component, that is, the Fragment component is embedded into the Activity component to serve as the Activity component.
In an embodiment, the first Toast component creating unit 120 comprises:
the label adding judgment unit is used for judging whether the Activity component is added with a Fragment component labeled as FToast;
the first label processing unit is used for displaying the Fragment component if the Activity component is added with the Fragment component labeled as FToast;
and the second label processing unit is used for automatically adding a Fragment component as a Toast component if the Fragment component labeled as FToast is not added to the Activity component.
In this embodiment, when adding a Fragment component to an Activity component as a Toast component, first determining whether the current Activity component has added a Fragment component labeled "FToast" once, if so, directly displaying the Fragment component, and updating the corresponding text content; if the Fragment component labeled "FToast" is not added, a Fragment component is directly added as the Toast component.
Because the Android pages are all composed of Activity/Fragment, Fragment can be loaded on more than any two pages. Whether the Android X or the traditional support package is adopted, the display and hiding of fragments can be supported.
And Fragment has the same life cycle as Activity, when the page changes, Toast can change at any time and change along with the change of the page, so that memory leakage does not exist, and the code performance is optimized. The Fragment component is not managed by the notification queue of the android system any more, is not influenced by the setting of the user, and can correctly display the Toast component at the time needing displaying.
In an embodiment, the second tag processing unit is further configured to:
adding Fragment components to the layout of the Activity component in a tag form to obtain the Toast component.
In this embodiment, when adding a Fragment component to an Activity component, a static registration mode may be adopted, that is, the Fragment component is added to the layout of the Activity component in a tag form to obtain a Toast component, and this addition mode is more rapid.
In specific implementation, a dynamic registration mode can be adopted, namely, the Fragment component is added into the existing host Activity component through Java code, and the adding mode can ensure rapidness.
A second Toast component creating unit 130, configured to, if the message component type corresponding to the current context information is a Fragment component, associate the Fragment component with the Activity component, so as to use the Fragment component as a Toast component.
In this embodiment, if the message component type corresponding to the current context information is a Fragment component, the Activity component hosted by the Fragment component may be obtained, and then the Fragment component and the Activity component are associated to serve as the Toast component, and then only the time of the Toast component needs to be updated, and the text needs to be refreshed.
And a prompt trigger judging unit 140, configured to judge whether the current user operation information satisfies a prompt trigger condition.
In this embodiment, after a Fragment component is added locally to the intelligent terminal to serve as a Toast component, it needs to be detected whether current user operation information corresponding to the current operation of the user meets a prompt trigger condition. For example, when the account and the password currently input by the user fail to pass the verification of the server, it may be considered that a prompt trigger condition is triggered, and at this time, a pop-up prompt should be timely performed on the intelligent terminal.
And a prompt information generating unit 150, configured to generate, if the current user operation information meets a prompt trigger condition, prompt information corresponding to the current user operation information, and fill the prompt information in the Toast component.
In this embodiment, if the current user operation information meets the prompt triggering condition, it indicates that the prompt information needs to be displayed in a pop-up window form through the Toast component in time. At this time, in order to prompt an event more accurately, it is necessary to determine an event type (for example, a user login event) according to the current user operation, acquire a processing result (for example, login failure) fed back by the server in response to the user operation determination event, generate corresponding prompt information according to the event type and the processing result (for example, the generated prompt information indicates that the user account fails to be verified, the user fails to login, and the user is asked to re-input a login account number and a password), and fill the prompt information in the Toast component.
And the prompt information display unit 160 is used for popping up and displaying the Toast component filled with the prompt information.
In this embodiment, after the prompt information is filled in the local Toast component of the intelligent terminal, the Toast component filled with the prompt information is popped up and displayed, so as to prompt the user to perform corresponding operation according to the prompt information in time. And because the carrier of the Toast is Fragment, the Toast with any style in the application can be realized, and the required Toast can be flexibly defined according to the requirement.
In an embodiment, the Toast message pushing device 100 based on android fragments further includes:
the first system time acquisition unit is used for acquiring the current system time.
In this embodiment, while obtaining the message component type corresponding to the current context information, it is also required to obtain the current system time, so as to be used as a time reference point for the subsequent calculation of when to hide the Fragment component.
In an embodiment, the Toast message pushing device 100 based on android fragments further includes:
the time difference judging unit is used for acquiring and judging whether the time difference between the current latest system time and the current system time exceeds a preset time threshold value or not;
and the Fragment component hidden switching unit is used for switching the Fragment component to a hidden state if the time difference between the current latest system time and the current system exceeds the time threshold.
In this embodiment, the purpose of obtaining and determining whether the time difference between the current latest system time and the current system time exceeds a preset time threshold is to accurately determine whether the Fragment component needs to be switched to the hidden state at the time corresponding to the current latest system time. For example, if the set time threshold is 1800ms, hiding the Fragment component correspondingly added if the time difference between the current latest system time and the current system exceeds 1800ms, and waiting for the next time when the Fragment component needs to be displayed, and using the Fragment component as the Toast component push message.
In an embodiment, the Toast message pushing device 100 based on android fragments further comprises:
the Toast component counting unit is used for judging whether the Activity components comprise a plurality of Toast components;
the middle transmission unit is used for transmitting information to be transmitted to the Activity component if the Activity component comprises a plurality of Toast components and one Toast component transmits information to another target Toast component;
and the Bundle forwarding unit is used for sending the information to be transmitted to the target Toast component through the Bundle file of the Activity component.
In this embodiment, if the Activity component in the local of the intelligent terminal includes a plurality of Toast components, the Activity component is used as an intermediate carrier during communication between the Toast components. One Toast component transmits information to another target Toast component, the information flow direction is Fragment- > Activity- > Fragment, because a plurality of Fragment components are attached to the same Activity component, the information to be transmitted can be transmitted to the target Toast component by transmitting the value to the commonly attached Activity components and then transmitting the information to be transmitted to the target Toast component through a Bundle file of the Activity components (the Bundle file is an executable file and is used for transmitting data between activities of Android).
The device has realized that after having closed APP notice authority on the intelligent terminal of having installed tall and erect system, also can carry out the message propelling movement based on Fragment subassembly's Toast, ensures that the user in time receives the notice message.
The above Toast message pushing apparatus based on the android fragment component can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in fig. 3.
Referring to fig. 3, fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device 500 is an intelligent terminal, and the intelligent terminal can be an electronic device with a communication function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device.
Referring to fig. 3, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, may cause the processor 502 to perform a Toast message pushing method based on the android shard component.
The processor 502 is used to provide computing and control capabilities that support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to execute the Toast message pushing method based on the android fragmentation component.
The network interface 505 is used for network communication, such as providing transmission of data information. Those skilled in the art will appreciate that the configuration shown in fig. 3 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing device 500 to which aspects of the present invention may be applied, and that a particular computing device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The processor 502 is configured to run a computer program 5032 stored in the memory, so as to implement the method for pushing the Toast message based on the android fragmentation component disclosed in the embodiment of the present invention.
Those skilled in the art will appreciate that the embodiment of a computer device illustrated in fig. 3 does not constitute a limitation on the specific construction of the computer device, and in other embodiments a computer device may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 3, and are not described herein again.
It should be understood that, in the embodiment of the present invention, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the invention, a computer-readable storage medium is provided. The computer readable storage medium may be a non-volatile computer readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the method for pushing Toast messages based on android fragments component disclosed in the embodiments of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided by the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only a logical division, and there may be other divisions when the actual implementation is performed, or units having the same function may be grouped into one unit, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A Toast message pushing method based on an android fragment component is characterized by comprising the following steps:
acquiring local current context information, and acquiring a message component type corresponding to the current context information; wherein the message component types comprise an Activity component and a Fragment component;
if the message component type corresponding to the current context information is an Activity component, automatically adding a Fragment component as a Toast component;
if the message component type corresponding to the current context information is a Fragment component, establishing association between the Fragment component and an Activity component so as to use the Fragment component as a Toast component;
judging whether the current user operation information meets a prompt triggering condition;
if the current user operation information meets a prompt triggering condition, generating prompt information corresponding to the current user operation information, and filling the prompt information into a Toast component; and
and popping up and displaying the Toast component filled with the prompt message.
2. The android Fragment component-based toastt message pushing method according to claim 1, wherein said automatically adding a Fragment component as a Toast component comprises:
judging whether the Activity component is added with a Fragment component labeled as FToast;
if the Activity component is added with a Fragment component labeled as FToast, displaying the Fragment component;
if the Activity component does not add a Fragment component labeled FToast, a Fragment component is automatically added to serve as a Toast component.
3. The android Fragment component-based toastt message pushing method according to claim 2, wherein said automatically adding a Fragment component as a Toast component comprises:
adding Fragment components to the layout of the Activity component in a tag form to obtain the Toast component.
4. The android fragment component-based toastt message pushing method according to claim 1, wherein the populating the Toast component with the hint information comprises:
filling the prompt information into an FToastUtils.
5. The Toast message pushing method based on android fragmentation component as claimed in claim 1, further comprising, after obtaining the message component type corresponding to the current context information:
acquiring current system time;
after popping up and displaying the Toast component filled with the prompt message, the method further comprises the following steps:
acquiring and judging whether the time difference between the current latest system time and the current system time exceeds a preset time threshold value or not;
and if the time difference between the current latest system time and the current system exceeds the time threshold, switching the Fragment component to a hidden state.
6. The android fragment component-based toastt message pushing method of claim 1, further comprising:
judging whether the Activity component comprises a plurality of Toast components;
if the Activity component comprises a plurality of Toast components and one Toast component transmits information to another target Toast component, transmitting the information to be transmitted to the Activity component;
and sending the information to be transmitted to the target Toast component through the Bundle file of the Activity component.
7. A Toast message pushing device based on android fragment components is characterized by comprising:
the message component type acquiring unit is used for acquiring local current context information and acquiring a message component type corresponding to the current context information; wherein the message component types comprise an Activity component and a Fragment component;
a first Toast component creating unit, configured to automatically add a Fragment component as a Toast component if the message component type corresponding to the current context information is an Activity component;
a second Toast component creating unit, configured to, if the message component type corresponding to the current context information is a Fragment component, associate the Fragment component with an Activity component, so as to use the Fragment component as a Toast component;
the prompt trigger judging unit is used for judging whether the current user operation information meets a prompt trigger condition;
a prompt information generating unit, configured to generate prompt information corresponding to the current user operation information if the current user operation information meets a prompt trigger condition, and fill the prompt information in a Toast component; and
and the prompt information display unit is used for popping up and displaying the Toast assembly filled with the prompt information.
8. The android fragment component-based toastt message pushing device of claim 1, wherein the message component type obtaining unit is further configured to:
acquiring current system time;
the Toast message pushing device based on the android fragment component further comprises:
the time difference judging unit is used for acquiring and judging whether the time difference between the current latest system time and the current system time exceeds a preset time threshold value or not;
and the Fragment component hidden switching unit is used for switching the Fragment component to a hidden state if the time difference between the current latest system time and the current system exceeds the time threshold.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method for pushing Toast messages based on android fragmented components as claimed in any of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to execute the android fragment component-based Toast message pushing method according to any one of claims 1 to 6.
CN202011246207.9A 2020-11-10 2020-11-10 Toast message pushing method and device based on android fragment component and computer equipment Pending CN112199078A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011246207.9A CN112199078A (en) 2020-11-10 2020-11-10 Toast message pushing method and device based on android fragment component and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011246207.9A CN112199078A (en) 2020-11-10 2020-11-10 Toast message pushing method and device based on android fragment component and computer equipment

Publications (1)

Publication Number Publication Date
CN112199078A true CN112199078A (en) 2021-01-08

Family

ID=74034253

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011246207.9A Pending CN112199078A (en) 2020-11-10 2020-11-10 Toast message pushing method and device based on android fragment component and computer equipment

Country Status (1)

Country Link
CN (1) CN112199078A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113535132A (en) * 2021-07-26 2021-10-22 中移(杭州)信息技术有限公司 Device access method, device, terminal device and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113535132A (en) * 2021-07-26 2021-10-22 中移(杭州)信息技术有限公司 Device access method, device, terminal device and storage medium

Similar Documents

Publication Publication Date Title
CN111314141B (en) Route updating method and device
US11317257B2 (en) Verification code obtaining method and apparatus, and terminal
CN107832099B (en) Method and device for client version compatibility and storage medium
CN108762956B (en) Method for acquiring Native local data, server, mobile terminal and storage medium
CN112867988A (en) Implementing compliance settings by a mobile device to follow a configuration scenario
CN104685469A (en) Background application page architecture for WEB applications
CN111737609B (en) WEB system menu bar display method, terminal and storage medium
EP2960793B1 (en) Communication between frames of a web browser
CN111190673B (en) Page display method and device based on operation monitoring and electronic equipment
CN104992081A (en) Security enhancement method for third-party code of Android application program
EP3955107B1 (en) Sub-application development method, apparatus, computer device, and storage medium
US11310289B2 (en) Systems and methods for generating a shortcut associated with a rich communication services messaging session
CN105376719A (en) Information pushing method and device
CN111596971B (en) Application cleaning method and device, storage medium and electronic equipment
CN112199078A (en) Toast message pushing method and device based on android fragment component and computer equipment
CN112015563B (en) Message queue switching method and device, electronic equipment and storage medium
CN116627444A (en) System and method for automatically synchronizing responses and conditions on a device
CN111381976B (en) Method and device for updating message prompt data, storage medium and computer equipment
CN113467656B (en) Screen touch event notification method and vehicle machine
CN107168776B (en) Event statistical method, device, equipment and storage medium
CN111124627A (en) Method, device, terminal and storage medium for determining application program caller
CN112416374B (en) Data processing method, device, terminal and storage medium
KR20180065535A (en) System and method for detecting kernel rootkit
CN112184136A (en) Task card processing method and device
CN111026317A (en) Method, device and storage medium for determining user operation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination