CN112241296A - Page switching method and device in application - Google Patents
Page switching method and device in application Download PDFInfo
- Publication number
- CN112241296A CN112241296A CN201910646166.3A CN201910646166A CN112241296A CN 112241296 A CN112241296 A CN 112241296A CN 201910646166 A CN201910646166 A CN 201910646166A CN 112241296 A CN112241296 A CN 112241296A
- Authority
- CN
- China
- Prior art keywords
- page
- switching
- intent
- application
- flag
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 230000004044 response Effects 0.000 claims description 5
- 238000006243 chemical reaction Methods 0.000 abstract description 10
- 230000000694 effects Effects 0.000 description 65
- 230000006870 function Effects 0.000 description 12
- 230000000875 corresponding effect Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 6
- 238000004590 computer program Methods 0.000 description 5
- 230000003993 interaction Effects 0.000 description 4
- 230000001960 triggered effect Effects 0.000 description 4
- 230000008901 benefit Effects 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 2
- 230000002411 adverse Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000006378 damage Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000007704 transition Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/431—Generation of visual interfaces for content selection or interaction; Content or additional data rendering
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a page switching method and device in application. Wherein the method comprises the following steps: dynamically setting a page starting mode in an application; after at least two pages are started according to the set page starting mode, responding to a first switching request of a first page, adjusting the stack order in an independent stack where the first page is located, and switching to a second page. By the technical scheme, the page starting mode can be dynamically changed in the application, and the switching to the second page is realized under the condition that the normal operation of the first page is not influenced by the adjustment of the stack order, so that conditions are created for displaying the conversion control on the current page and switching back to the first page through the conversion control; and normal starting of pages in all applications of the mobile terminal with the android system can be supported, and the problem of android system version compatibility is avoided.
Description
Technical Field
The invention relates to the field of application development, in particular to a page switching method and device in an application.
Background
The Android system can implement PIP (picture in picture) mode on Android n (Android 8.0, Api 26), allowing an application to run, for example, one video Activity in a fixed window while continuing to run other activities in the background. Therefore, if the PIP mode is to be implemented in the low version, a new scheme is required for compatibility. And when switching to the PIP mode in the Android application, some functions will be disabled or ignored, and some system UI custom options will be disabled. For example, in non-full screen mode, the application cannot hide the status bar, or the system will ignore changes made to the android: screenorganization property.
Additionally, by default, the android system does not automatically provide PIP support for applications, such as requiring registration in a manifest file and specifying layout change information for Activity that otherwise would not restart when a layout change occurs during a PIP mode transition.
Further, when the PIP mode is applicable to a live broadcast application, after a user clicks and watches a certain live broadcast room from a live broadcast recommendation list page, if the user wants to go back to the live broadcast recommendation list page to browse other live broadcast programs, the live broadcast room is closed, and audio and video streams of the live broadcast room are also cut off, which affects the impression of the user. How to realize that when a user switches to a live broadcast recommendation list page, the page of the live broadcast room is not closed and audio and/or video playing can be normally performed, for example, only minimizing processing is performed on the live broadcast room, which is also a technical problem that needs to be solved currently.
The present invention provides a new solution to the above-mentioned problems.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a page switching method and apparatus in an application that overcomes or at least partially solves the above problems.
According to one aspect of the invention, a page switching method in an application is provided, wherein the method comprises the following steps:
dynamically setting a page starting mode in an application;
after at least two pages are started according to the set page starting mode, responding to a first switching request of a first page, adjusting the stack order in an independent stack where the first page is located, and switching to a second page.
Optionally, the page starting mode is an in-stack multiplexing mode.
Optionally, the dynamically setting a page starting mode in the application includes:
and determining the page starting mode of each page by setting an Intent mark.
Optionally, the Intent flag includes one or more of the following:
Intent.FLAG_ACTIVITY_NEW_TASK;
Intent.FLAG_ACTIVITY_CLEAR_TOP;
Intent.FLAG_ACTIVITY_SINGLE_TOP。
optionally, the first switching request is a request to minimize the first page.
Optionally, the adjusting the stack order in the independent stack where the first page is located, and the switching to the second page includes:
and setting an Intent flag of Intent _ active _ REORDER _ TO _ FRONT for the second page, and switching TO the second page through an onenewintent () function.
Optionally, the method further includes: generating a switching control corresponding to the first page, and displaying the switching control on the current page of the application;
and responding to the trigger of the switching control, and switching to the first page.
Optionally, the responding to the trigger of the switching control, the switching to the first page includes:
and setting an Intent mark for the first page, and then ending the current page.
Optionally, the Intent flag is
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT。
According to another aspect of the present invention, there is provided a page switching apparatus in an application, wherein the apparatus includes:
the starting mode setting unit is suitable for dynamically setting a page starting mode in the application;
and the page switching unit is suitable for responding to a first switching request to the first page after at least two pages are started according to the set page starting mode, adjusting the stack order in the independent stack where the first page is located, and switching to the second page.
Optionally, the page starting mode is an in-stack multiplexing mode.
Optionally, the start mode setting unit is adapted to:
and determining the page starting mode of each page by setting an Intent mark.
Optionally, the Intent flag includes one or more of the following:
Intent.FLAG_ACTIVITY_NEW_TASK;
Intent.FLAG_ACTIVITY_CLEAR_TOP;
Intent.FLAG_ACTIVITY_SINGLE_TOP。
optionally, the first switching request is a request to minimize the first page.
Optionally, the page switching unit is adapted to:
and setting an Intent flag of Intent _ active _ REORDER _ TO _ FRONT for the second page, and switching TO the second page through an onenewintent () function.
Optionally, the apparatus further comprises: the switching control generating unit is suitable for generating a switching control corresponding to the first page and displaying the switching control on the current page of the application;
and responding to the trigger of the switching control, and switching to the first page.
Optionally, the switching control generating unit is adapted to:
and setting an Intent mark for the first page, and then ending the current page.
Optionally, the Intent flag is
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT。
In accordance with still another aspect of the present invention, there is provided an electronic apparatus including: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform a method as any one of the above.
According to a further aspect of the invention, there is provided a computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement a method as any one of the above.
According to the technical scheme, the page starting mode in the application is dynamically set; after at least two pages are started according to the set page starting mode, responding to a first switching request of a first page, adjusting the stack order in an independent stack where the first page is located, and switching to a second page. By the technical scheme, the page starting mode can be dynamically changed in the application, and the switching to the second page is realized under the condition that the normal operation of the first page is not influenced by the adjustment of the stack order, so that conditions are created for displaying the conversion control on the second page and switching back to the first page through the conversion control; and normal starting of pages in all applications of the mobile terminal with the android system can be supported, and the problem of android system version compatibility is avoided.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flowchart illustrating a page switching method in an application according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a page switching apparatus in an application according to an embodiment of the present invention;
FIG. 3 shows a schematic structural diagram of an electronic device according to one embodiment of the invention;
fig. 4 shows a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Fig. 1 shows a page switching method in an application according to an embodiment of the present invention, wherein the method includes:
step S110, dynamically setting a page start mode in the application.
In order to avoid the problems of subsequent adjustment and configuration caused by registering Activity in the manifest file when the conventional android system utilizes the PIP mode, in the embodiment, the manifest file is not used for registering the Activity startup mode, and a page Activity startup mode capable of dynamically setting the application is designed. For example, the dynamic setting may be to launch page Activity in an Intent-only manner.
By adopting the dynamic setting starting mode, the embodiment can flexibly start the new page Activity and can avoid the adverse effect on the subsequent processing caused by the operations such as configuration in the manifest file.
Step S120, after at least two pages are started according to the set page start mode, in response to a first switching request for the first page, adjusting a stack order in the independent stack where the first page is located, and switching to the second page.
In this step, it is often the case that after a certain application host interface Activity is launched, other page activities are launched. Taking a live broadcast application as an example, firstly starting a live broadcast recommendation list page as a second page through the starting mode, then clicking and watching a certain live broadcast room, opening the page of the live broadcast room as a first page, and placing the corresponding Activity at the stack top of an independent stack (Task). By the method, under the condition that normal playing of the first page in the live broadcast room is not influenced, the first switching request for the first page is responded, for example, a minimizing button in the first page is clicked, the stack order in the independent stack where the first page is located is triggered and adjusted, and therefore the first page is switched to the second page (namely, a live broadcast recommendation list page). Moreover, after the switching is realized, the first page is generally covered by the second page, and the audio and video stream of the first page cannot be interrupted and restarted due to the page switching, so that the problems of performance reduction or flow consumption and the like caused by destruction of a video picture and re-pulling of the stream cannot be caused, the user can use the live broadcast function smoothly and efficiently, and the user experience is improved.
Of course, the Activity of the second page and the Activity of the first page are not necessarily adjacent to each other in the independent stack, and generally the Activity corresponding to the first page is located at the top of the stack, and the second page may be located at any other position in the independent stack.
It can be seen that, in the technical solution disclosed in this embodiment, first, a page start mode in an application is dynamically set; and after at least two pages are started according to the set page starting mode, responding to a first switching request of the first page, adjusting the stack order in the independent stack where the first page is located, and switching to the second page. By the technical scheme, the page starting mode can be dynamically changed in the application, and the switching to the second page is realized under the condition that the normal operation of the first page is not influenced by the adjustment of the stack order, so that conditions are created for displaying the conversion control on the second page and switching back to the first page through the conversion control; and normal starting of pages in all applications of the mobile terminal with the android system can be supported, and the problem of android system version compatibility is avoided.
In one embodiment, the page launch mode is an in-stack multiplexing mode.
The in-stack multiplexing mode (singTask) is one of four loading modes of the Activities, and is a singleton mode, the in-stack multiplexing mode is to detect whether the Activities which need to be started currently exist in the whole stack, if so, the Activities are directly placed on the top of the stack, the Activities above the Activities are all removed from the task stack and destroyed, meanwhile, an oneNewIntent function is called back, and the singTask mode is more suitable for the main interface Activities of the application. Therefore, by the method, when the Activity of a certain page is started, the activities above the Activity are all removed from the task stack and destroyed, so that the purity in the stack is kept, and the influence on subsequent operation is reduced.
Generally, the in-stack multiplexing mode is also set in a manner of a manifest file, and in the embodiment of the present invention, the in-stack multiplexing mode may be dynamically set in an Intent manner to avoid problems such as logic conflicts that may occur during page switching.
In one embodiment, dynamically setting a page launch mode in an application comprises: and determining the page starting mode of each page by setting an Intent mark.
In the android system, Intent is a data bearer for data transmission among components (or applications) of the system, and can be used for interaction among applications, and also can be used for interaction among Activity, Service and Broadcast Receiver inside the applications. The state of each Activity is determined by the position of the Activity in the Activity stack, and the Intent mark (Flag) can control the loading sequence of Activities in the Activity stack, thereby determining the starting mode of each page.
In one embodiment, the Intent flag includes one or more of the following:
Intent.FLAG_ACTIVITY_NEW_TASK;
Intent.FLAG_ACTIVITY_CLEAR_TOP;
Intent.FLAG_ACTIVITY_SINGLE_TOP。
when the Intent flag is used to set the startup mode, the following two flags are typically used:
Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
however, some android models may require the following three flags to be used simultaneously to achieve the effect of the in-stack multiplexing mode:
Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
through the dynamic setting, the influence or limitation of an android system or other Activities on the subsequent operation of the method disclosed by the embodiment can be reduced, and a good environment is created for the subsequent processing.
In one embodiment, the first switch request is a request to minimize the first page.
Take a live application as an example, where the first switch request is a minimize request, implemented through a minimize control disposed on the first page. Like general video software, the first page is not exited after minimization, but is instead run in the background, wherein the live video can still continue.
In one embodiment, adjusting the stacking order in the independent stack where the first page is located, and switching to the second page includes: setting for the second page
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
This Intent flag, toggles to the second page through the onNewintent () function.
Flag _ ACTIVITY _ REORDER _ TO _ FRONT is an android page start mode that has fewer application scenarios and is not related TO minimization operation. Therefore, the embodiment well solves the problems of adaptation of various models of the android system and the like by applying the mark to page switching.
In one embodiment, the method further comprises: generating a switching control corresponding to the first page, and displaying the switching control on the current page of the application; and responding to the trigger of the switching control, and switching to the first page.
The minimized first page Activity can be placed on the top of the stack again by triggering the switching control, and the first page is displayed. The switching control can be in an application level or an android system level, the switching control can be designed to be hidden in a system or an application in advance, after the switching operation of the minimized first page is triggered, the switching control is displayed on the current page of the application, the switching control is clicked again, and the first page can be switched back.
In one embodiment, in response to the triggering of the toggle control, toggling to the first page includes: and setting an Intent mark for the first page, and then ending the current page.
The solution of a system bug that occurs when the present flag _ ACTIVITY _ REORDER _ TO _ FRONT flag is applied is described in this embodiment. For example, after opening a first page with the flag, the application returns to the desktop of the android system instead of going back to a second page when the first page is normally closed. In order to solve the system bug, if the new first page is opened by using the Intent mark, when returning, firstly setting a certain Intent mark on the first page to open a second page to be returned, and then closing the current first page.
In one embodiment, Intent flag is
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT。
Because the problem occurs when the present flag _ active _ REORDER _ TO _ FRONT flag is used, when the first page is closed, the present flag needs TO be set TO switch back TO the second page, and then the first page is closed.
FIG. 2 is a schematic structural diagram of a page switching apparatus 200 in an application according to an embodiment of the present invention; wherein the apparatus 200 comprises:
the starting mode setting unit 210 is adapted to dynamically set a page starting mode in the application.
In order to avoid the problems of subsequent adjustment and configuration caused by registering Activity in the manifest file when the conventional android system utilizes the PIP mode, in the embodiment, the manifest file is not used for registering the Activity startup mode, and a page Activity startup mode capable of dynamically setting the application is designed. For example, the dynamic setting may be to launch page Activity in an Intent-only manner.
By adopting the dynamic setting starting mode, the embodiment can flexibly start the new page Activity and can avoid the adverse effect on the subsequent processing caused by the operations such as configuration in the manifest file.
The page switching unit 220 is adapted to adjust a stack order in an independent stack where the first page is located in response to a first switching request for the first page and switch to the second page after the at least two pages are started according to the set page starting mode.
In this unit, it is often the case that after a certain application host interface Activity is launched, other page activities are launched. Taking a live broadcast application as an example, firstly starting a live broadcast recommendation list page as a second page through the starting mode, then clicking and watching a certain live broadcast room, opening the page of the live broadcast room as a first page, and placing the corresponding Activity at the stack top of an independent stack (Task). By the method, under the condition that normal playing of the first page in the live broadcast room is not influenced, the first switching request for the first page is responded, for example, a minimizing button in the first page is clicked, the stack order in the independent stack where the first page is located is triggered and adjusted, and therefore the first page is switched to the second page (namely, a live broadcast recommendation list page). Moreover, after the switching is realized, the first page is generally covered by the second page, and the audio and video stream of the first page cannot be interrupted and restarted due to the page switching, so that the problems of performance reduction or flow consumption and the like caused by destruction of a video picture and re-pulling of the stream cannot be caused, the user can use the live broadcast function smoothly and efficiently, and the user experience is improved.
Of course, the Activity of the second page and the Activity of the first page are not necessarily adjacent to each other in the independent stack, and generally the Activity corresponding to the first page is located at the top of the stack, and the second page may be located at any other position in the independent stack.
It can be seen that, in the technical solution disclosed in this embodiment, first, a page start mode in an application is dynamically set; and after at least two pages are started according to the set page starting mode, responding to a first switching request of the first page, adjusting the stack order in the independent stack where the first page is located, and switching to the second page. By the technical scheme, the page starting mode can be dynamically changed in the application, and the switching to the second page is realized under the condition that the normal operation of the first page is not influenced by the adjustment of the stack order, so that conditions are created for displaying the conversion control on the second page and switching back to the first page through the conversion control; and normal starting of pages in all applications of the mobile terminal with the android system can be supported, and the problem of android system version compatibility is avoided.
In one embodiment, the page launch mode is an in-stack multiplexing mode.
The in-stack multiplexing mode (singTask) is one of four loading modes of the Activities, and is a singleton mode, the in-stack multiplexing mode is to detect whether the Activities which need to be started currently exist in the whole stack, if so, the Activities are directly placed on the top of the stack, the Activities above the Activities are all removed from the task stack and destroyed, meanwhile, an oneNewIntent function is called back, and the singTask mode is more suitable for the main interface Activities of the application. Therefore, by the method, when the Activity of a certain page is started, the activities above the Activity are all removed from the task stack and destroyed, so that the purity in the stack is kept, and the influence on subsequent operation is reduced.
Generally, the in-stack multiplexing mode is also set in a manner of a manifest file, and in the embodiment of the present invention, the in-stack multiplexing mode may be dynamically set in an Intent manner to avoid problems such as logic conflicts that may occur during page switching.
In one embodiment, the start mode setting unit 210 is adapted to: and determining the page starting mode of each page by setting an Intent mark.
In the android system, Intent is a data bearer for data transmission among components (or applications) of the system, and can be used for interaction among applications, and also can be used for interaction among Activity, Service and Broadcast Receiver inside the applications. The state of each Activity is determined by the position of the Activity in the Activity stack, and the Intent mark (Flag) can control the loading sequence of Activities in the Activity stack, thereby determining the starting mode of each page.
In one embodiment, the Intent flag includes one or more of the following:
Intent.FLAG_ACTIVITY_NEW_TASK;
Intent.FLAG_ACTIVITY_CLEAR_TOP;
Intent.FLAG_ACTIVITY_SINGLE_TOP。
when the Intent flag is used to set the startup mode, the following two flags are typically used:
Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)。
however, some android models may require the following three flags to be used simultaneously to achieve the effect of the in-stack multiplexing mode:
Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)。
through the dynamic setting, the influence or limitation of an android system or other Activities on the subsequent operation of the method disclosed by the embodiment can be reduced, and a good environment is created for the subsequent processing.
In one embodiment, the first switch request is a request to minimize the first page.
Take a live application as an example, where the first switch request is a minimize request, implemented through a minimize control disposed on the first page. Like general video software, the first page is not exited after minimization, but is instead run in the background, wherein the live video can still continue.
In one embodiment, the page switching unit 220 is adapted to: set up for the second page
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
This Intent flag, toggles to the second page through the onNewintent () function.
Flag _ ACTIVITY _ REORDER _ TO _ FRONT is an android page start mode that has fewer application scenarios and is not related TO minimization operation. Therefore, the embodiment well solves the problems of adaptation of various models of the android system and the like by applying the mark to page switching.
In one embodiment, the apparatus further comprises: the switching control generating unit is suitable for generating a switching control corresponding to the first page and displaying the switching control on the current page of the application; and responding to the trigger of the switching control, and switching to the first page.
The minimized first page Activity can be placed on the top of the stack again by triggering the switching control, and the first page is displayed. The switching control can be in an application level or an android system level, the switching control can be designed to be hidden in a system or an application in advance, after the switching operation of the minimized first page is triggered, the switching control is displayed on the current page of the application, the switching control is clicked again, and the first page can be switched back.
In one embodiment, the toggle control generation unit is adapted to: and setting an Intent mark for the first page, and then ending the current page.
The solution of a system bug that occurs when the present flag _ ACTIVITY _ REORDER _ TO _ FRONT flag is applied is described in this embodiment. For example, after opening a first page with the flag, the application returns to the desktop of the android system instead of going back to a second page when the first page is normally closed. In order to solve the system bug, if the new first page is opened by using the Intent mark, when returning, firstly setting a certain Intent mark on the first page to open a second page to be returned, and then closing the current first page.
In one embodiment, Intent flag is
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT。
Because the problem occurs when the present flag _ active _ REORDER _ TO _ FRONT flag is used, when the first page is closed, the present flag needs TO be set TO switch back TO the second page, and then the first page is closed.
In summary, according to the technical solution of the present invention, first, a page start mode in an application is dynamically set; and after at least two pages are started according to the set page starting mode, responding to a first switching request of the first page, adjusting the stack order in the independent stack where the first page is located, and switching to the second page. By the technical scheme, the page starting mode can be dynamically changed in the application, and the switching to the second page is realized under the condition that the normal operation of the first page is not influenced by the adjustment of the stack order, so that conditions are created for displaying the conversion control on the second page and switching back to the first page through the conversion control; and normal starting of pages in all applications of the mobile terminal with the android system can be supported, and the problem of android system version compatibility is avoided.
It should be noted that:
the algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose devices may be used with the teachings herein. The required structure for constructing such a device will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a page switching apparatus in an application according to an embodiment of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
For example, fig. 3 shows a schematic structural diagram of an electronic device according to an embodiment of the invention. The electronic device 300 comprises a processor 310 and a memory 320 arranged to store computer executable instructions (computer readable program code). The memory 320 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. The memory 320 has a storage space 330 storing computer readable program code 331 for performing any of the method steps described above. For example, the storage space 330 for storing the computer readable program code may comprise respective computer readable program codes 331 for respectively implementing various steps in the above method. The computer readable program code 331 may be read from or written to one or more computer program products. These computer program products comprise a program code carrier such as a hard disk, a Compact Disc (CD), a memory card or a floppy disk. Such a computer program product is typically a computer readable storage medium such as described in fig. 4. Fig. 4 shows a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention. The computer readable storage medium 400 has stored thereon a computer readable program code 331 for performing the steps of the method according to the invention, readable by a processor 310 of the electronic device 300, which computer readable program code 331, when executed by the electronic device 300, causes the electronic device 300 to perform the steps of the method described above, in particular the computer readable program code 331 stored on the computer readable storage medium may perform the method shown in any of the embodiments described above. The computer readable program code 331 may be compressed in a suitable form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The embodiment of the invention discloses A1 and a page switching method in application, wherein the method comprises the following steps:
dynamically setting a page starting mode in an application;
after at least two pages are started according to the set page starting mode, responding to a first switching request of a first page, adjusting the stack order in an independent stack where the first page is located, and switching to a second page.
A2, the method of A1, wherein the page launch mode is an in-stack multiplexing mode.
A3, the method of A1, wherein the dynamically setting page launch mode in an application comprises:
and determining the page starting mode of each page by setting an Intent mark.
A4, the method of A3, wherein the Intent tag comprises one or more of:
Intent.FLAG_ACTIVITY_NEW_TASK;
Intent.FLAG_ACTIVITY_CLEAR_TOP;
Intent.FLAG_ACTIVITY_SINGLE_TOP。
a5, the method of A1, wherein the first switch request is a request to minimize a first page.
A6, the method as in a1, wherein the adjusting the stacking order in the independent stack where the first page is located, and the switching to the second page includes:
and setting an Intent flag of Intent _ active _ REORDER _ TO _ FRONT for the second page, and switching TO the second page through an onenewintent () function.
A7, the method of a1, wherein the method further comprises: generating a switching control corresponding to the first page, and displaying the switching control on the current page of the application;
and responding to the trigger of the switching control, and switching to the first page.
A8, the method of A7, wherein the switching to the first page in response to the triggering of the switch control comprises:
and setting an Intent mark for the first page, and then ending the current page.
A9, the method of A8, wherein the Intent flag is Intent.
B10, a page switching device in an application, wherein the device comprises:
the starting mode setting unit is suitable for dynamically setting a page starting mode in the application;
and the page switching unit is suitable for responding to a first switching request to the first page after at least two pages are started according to the set page starting mode, adjusting the stack order in the independent stack where the first page is located, and switching to the second page.
B11, the apparatus as described in B10, wherein the page launch mode is an in-stack multiplexing mode.
B12, the apparatus as in B10, wherein the start mode setting unit is adapted to:
and determining the page starting mode of each page by setting an Intent mark.
B13, the apparatus according to B12, wherein the Intent flag comprises one or more of the following:
Intent.FLAG_ACTIVITY_NEW_TASK;
Intent.FLAG_ACTIVITY_CLEAR_TOP;
Intent.FLAG_ACTIVITY_SINGLE_TOP。
b14, the apparatus as in B10, wherein the first switch request is a request to minimize a first page.
B15, the apparatus as in B10, wherein the page switching unit is adapted to:
and setting an Intent flag of Intent _ active _ REORDER _ TO _ FRONT for the second page, and switching TO the second page through an onenewintent () function.
B16, the apparatus of B10, wherein the apparatus further comprises: the switching control generating unit is suitable for generating a switching control corresponding to the first page and displaying the switching control on the current page of the application;
and responding to the trigger of the switching control, and switching to the first page.
B17, the apparatus as in B16, wherein the toggle control generating unit is adapted to:
and setting an Intent mark for the first page, and then ending the current page.
B18, the apparatus of B17, wherein the Intent flag is Intent.
C19, an electronic device, wherein the electronic device comprises: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the method of any one of a1-a 9.
D20, a computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement the method of any of a1-a 9.
Claims (10)
1. A page switching method in an application, wherein the method comprises the following steps:
dynamically setting a page starting mode in an application;
after at least two pages are started according to the set page starting mode, responding to a first switching request of a first page, adjusting the stack order in an independent stack where the first page is located, and switching to a second page.
2. The method of claim 1, wherein the page launch mode is an in-stack multiplexing mode.
3. The method of claim 1, wherein the dynamically setting a page launch mode in an application comprises:
and determining the page starting mode of each page by setting an Intent mark.
4. The method of claim 3, wherein the Intent flag comprises one or more of:
Intent.FLAG_ACTIVITY_NEW_TASK;
Intent.FLAG_ACTIVITY_CLEAR_TOP;
Intent.FLAG_ACTIVITY_SINGLE_TOP。
5. the method of claim 1, wherein the first switch request is a request to minimize a first page.
6. The method of claim 1, wherein the adjusting the stacking order in the independent stack in which the first page resides, and switching to the second page comprises:
and setting an Intent flag of Intent _ active _ REORDER _ TO _ FRONT for the second page, and switching TO the second page through an onenewintent () function.
7. The method of claim 1, wherein the method further comprises: generating a switching control corresponding to the first page, and displaying the switching control on the current page of the application;
and responding to the trigger of the switching control, and switching to the first page.
8. The method of claim 7, wherein said switching to the first page in response to the triggering of the toggle control comprises:
and setting an Intent mark for the first page, and then ending the current page.
9. The method of claim 8, wherein the Intent flag is Intent.
10. An apparatus for switching pages in an application, wherein the apparatus comprises:
the starting mode setting unit is suitable for dynamically setting a page starting mode in the application;
and the page switching unit is suitable for responding to a first switching request to the first page after at least two pages are started according to the set page starting mode, adjusting the stack order in the independent stack where the first page is located, and switching to the second page.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910646166.3A CN112241296B (en) | 2019-07-17 | 2019-07-17 | Page switching method and device in application |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910646166.3A CN112241296B (en) | 2019-07-17 | 2019-07-17 | Page switching method and device in application |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112241296A true CN112241296A (en) | 2021-01-19 |
CN112241296B CN112241296B (en) | 2024-03-22 |
Family
ID=74167707
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910646166.3A Active CN112241296B (en) | 2019-07-17 | 2019-07-17 | Page switching method and device in application |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112241296B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113805962A (en) * | 2021-08-31 | 2021-12-17 | 北京百度网讯科技有限公司 | Application page display method and device and electronic equipment |
CN115292073A (en) * | 2022-10-09 | 2022-11-04 | 北京麟卓信息科技有限公司 | Method for sending android application file on Linux platform |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106778248A (en) * | 2016-12-26 | 2017-05-31 | 北京奇虎科技有限公司 | The method and apparatus that application program Activity starts |
CN107341018A (en) * | 2017-07-07 | 2017-11-10 | 广州优视网络科技有限公司 | A kind of method and apparatus for continuing to show view after page layout switch |
CN108089887A (en) * | 2016-11-18 | 2018-05-29 | 阿里巴巴集团控股有限公司 | A kind of startup control method and device of new added pages |
CN108763541A (en) * | 2018-05-31 | 2018-11-06 | 维沃移动通信有限公司 | A kind of page display method and terminal |
CN109086109A (en) * | 2018-06-25 | 2018-12-25 | 北京金山安全软件有限公司 | Page display method and device, electronic equipment and medium |
CN109614105A (en) * | 2018-12-13 | 2019-04-12 | 南开大学 | A kind of Android application return stack state static simulation method of Starting mode sensitivity |
CN109933386A (en) * | 2019-03-28 | 2019-06-25 | 努比亚技术有限公司 | The starting method, apparatus and computer readable storage medium of picture-in-picture mode |
-
2019
- 2019-07-17 CN CN201910646166.3A patent/CN112241296B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108089887A (en) * | 2016-11-18 | 2018-05-29 | 阿里巴巴集团控股有限公司 | A kind of startup control method and device of new added pages |
CN106778248A (en) * | 2016-12-26 | 2017-05-31 | 北京奇虎科技有限公司 | The method and apparatus that application program Activity starts |
CN107341018A (en) * | 2017-07-07 | 2017-11-10 | 广州优视网络科技有限公司 | A kind of method and apparatus for continuing to show view after page layout switch |
CN108763541A (en) * | 2018-05-31 | 2018-11-06 | 维沃移动通信有限公司 | A kind of page display method and terminal |
CN109086109A (en) * | 2018-06-25 | 2018-12-25 | 北京金山安全软件有限公司 | Page display method and device, electronic equipment and medium |
CN109614105A (en) * | 2018-12-13 | 2019-04-12 | 南开大学 | A kind of Android application return stack state static simulation method of Starting mode sensitivity |
CN109933386A (en) * | 2019-03-28 | 2019-06-25 | 努比亚技术有限公司 | The starting method, apparatus and computer readable storage medium of picture-in-picture mode |
Non-Patent Citations (1)
Title |
---|
TOAKSG: "解决FLAG_ACTIVITY_REORDER_TO_FRONT方式启动Activity,按返回键会出现卡死(ANR)的问题", pages 1 - 4, Retrieved from the Internet <URL:https://blog.csdn.net/zengd0/article/details/79810783> * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113805962A (en) * | 2021-08-31 | 2021-12-17 | 北京百度网讯科技有限公司 | Application page display method and device and electronic equipment |
CN113805962B (en) * | 2021-08-31 | 2023-10-20 | 北京百度网讯科技有限公司 | Application page display method and device and electronic equipment |
CN115292073A (en) * | 2022-10-09 | 2022-11-04 | 北京麟卓信息科技有限公司 | Method for sending android application file on Linux platform |
Also Published As
Publication number | Publication date |
---|---|
CN112241296B (en) | 2024-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11218739B2 (en) | Live video broadcast method, live broadcast device and storage medium | |
WO2018103550A1 (en) | Application program page processing method and apparatus | |
CN108153505B (en) | Display methods, electronic equipment and the computer storage medium of handwriting input content | |
US20170123783A1 (en) | Method for displaying plug-in view elements in host application page and electronic device | |
US20200194007A1 (en) | Voice interaction method, device and terminal | |
CN102238265B (en) | Mobile phone and method for realizing double-system mobile phone | |
CN112486451B (en) | Voice broadcasting method, computing device and computer storage medium | |
CN110019464B (en) | Page processing method and device | |
CN107797833A (en) | The interface display method of application program on smart machine | |
US20090094552A1 (en) | Guided Transition User Interfaces | |
CN112241296A (en) | Page switching method and device in application | |
CN109831688B (en) | Video suspension playing method and device based on iOS system | |
CN104899039A (en) | Method and device for providing screen shooting service in terminal device | |
CN111601154B (en) | Video processing method and related equipment | |
US11368633B2 (en) | Video switching method based on multi-channel decoding | |
JP2017507441A (en) | Firmware refresh method, apparatus, program, and recording medium | |
US20190037251A1 (en) | Playback apparatus, method of controlling playback apparatus, playback method and server apparatus | |
US20170105041A1 (en) | Method and device of interactive function card of smart television | |
US20120059961A1 (en) | System and method for sharing memory | |
US11907599B2 (en) | Information processing method, apparatus, electronic device, and storage medium | |
US11822936B2 (en) | Display device and display method thereof | |
CN111913776B (en) | Content display method, device and equipment | |
CN113076162B (en) | Processing method, device and storage medium for interactive scene plug-in half-screen display | |
CN108810631A (en) | Playback method, device, electronic equipment and the computer storage media of startup advertisement | |
US9466333B2 (en) | Content reproducing apparatus, content reproducing system, and content reproducing method |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |