CN109144638B - Android horizontal and vertical screen data synchronization method and device, terminal and readable medium - Google Patents

Android horizontal and vertical screen data synchronization method and device, terminal and readable medium Download PDF

Info

Publication number
CN109144638B
CN109144638B CN201810889891.9A CN201810889891A CN109144638B CN 109144638 B CN109144638 B CN 109144638B CN 201810889891 A CN201810889891 A CN 201810889891A CN 109144638 B CN109144638 B CN 109144638B
Authority
CN
China
Prior art keywords
data sharing
screen state
data
service control
control variable
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.)
Active
Application number
CN201810889891.9A
Other languages
Chinese (zh)
Other versions
CN109144638A (en
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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810889891.9A priority Critical patent/CN109144638B/en
Publication of CN109144638A publication Critical patent/CN109144638A/en
Application granted granted Critical
Publication of CN109144638B publication Critical patent/CN109144638B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The embodiment of the invention discloses a method, a device, a terminal and a readable medium for synchronizing horizontal and vertical screen data of Android, wherein the method comprises the following steps: receiving a switching instruction, and switching the service control in the first screen state into the service control in the second screen state according to the switching instruction; acquiring a business control variable in the data sharing object, and setting business control information of a second screen state according to the business control variable; and when an update message of the business control variable is received, updating the business control variable in the data sharing object according to the update message, and sending the updated business control variable to the second screen state through the data sharing protocol so as to update the business control information of the second screen state. According to the Android horizontal and vertical screen data synchronization method, device, terminal and readable medium provided by the embodiment of the invention, Android horizontal and vertical screen data synchronization is realized, data synchronization stability is improved, and the condition of data synchronization abnormity is avoided.

Description

Android horizontal and vertical screen data synchronization method and device, terminal and readable medium
Technical Field
The embodiment of the invention relates to a computer technology, in particular to a method, a device, a terminal and a readable medium for synchronizing horizontal and vertical screen data of Android.
Background
Generally, a method for switching horizontal and vertical screens of an Android terminal is to load the vertical/horizontal screens after the horizontal/vertical screens are completely closed, i.e. service logics between the horizontal screens and the vertical screens are completely separated. If data synchronization is to be completed when the horizontal screen and the vertical screen are switched, all the service state information in the horizontal/vertical screen needs to be copied before the horizontal/vertical screen is closed, and the copied service state information is used for realizing data synchronization when the vertical/horizontal screen is loaded. If the horizontal screen and the vertical screen are switched for many times, all the service state information in the horizontal/vertical screen needs to be copied for many times, which easily causes service function disorder and may cause abnormal data synchronization.
Disclosure of Invention
In view of this, embodiments of the present invention provide an Android horizontal and vertical screen data synchronization method, an Android horizontal and vertical screen data synchronization device, a terminal, and a readable medium, so that Android horizontal and vertical screen data synchronization is realized, data synchronization stability is improved, and a situation of data synchronization abnormality is avoided.
In a first aspect, an embodiment of the present invention provides an Android horizontal and vertical screen data synchronization method, including:
receiving a switching instruction, and switching the service control in the first screen state into the service control in the second screen state according to the switching instruction;
acquiring a business control variable in a data sharing object, and setting business control information of a second screen state according to the business control variable, wherein the data sharing object is a static global variable object of a data sharer class;
and when an update message of the business control variable is received, updating the business control variable in the data sharing object according to the update message, and sending the updated business control variable to the second screen state through the data sharing protocol so as to update the business control information of the second screen state.
Optionally, before the receiving the switching instruction, the method further includes:
when the first screen state is opened for the first time, calling a control loading method in an Activity lifecycle function onCreate function to load a business control of the first screen state;
and when the second screen state is opened for the first time, calling a control loading method in the lifecycle function onCreate function of the Activity to load the business control of the second screen state.
Optionally, before the receiving the switching instruction, the method further includes:
calling a sharer class definition method to define a data sharer class;
calling a data sharing object definition method to define a data sharing object of the data sharing device class;
and calling a service control variable definition method in the data sharing object to define a service control variable, initializing the service control variable, and updating the service control variable according to an update message of the service control variable when the update message is received.
Optionally, before the receiving the switching instruction, the method further includes:
calling a predefined data sharing object acquisition method to judge whether the data sharing object can be acquired or not;
if so, calling a return method to return the acquired data sharing object;
if not, calling a data sharing object instantiation method to construct the data sharing object, and calling a return method to return the constructed data sharing object.
Optionally, before the receiving the switching instruction, the method further includes:
and calling a protocol definition method in the data sharing object to define the data sharing protocol, and rewriting the data sharing protocol into the second screen state.
Optionally, the obtaining of the business control variable in the data sharing object includes:
and acquiring the business control variable in the data sharing object by a predefined business control variable acquisition method.
Optionally, when the first screen state is a vertical screen, the second screen state is a horizontal screen; and when the first screen state is a horizontal screen, the second screen state is a vertical screen.
In a second aspect, an embodiment of the present invention provides an Android horizontal and vertical screen data synchronization apparatus, including:
the service control switching module is used for receiving a switching instruction and switching the service control in the first screen state into the service control in the second screen state according to the switching instruction;
the service control information setting module is used for acquiring a service control variable in a data sharing object and setting service control information of a second screen state according to the service control variable, wherein the data sharing object is a static global variable object of a data sharer class;
and the service control information updating module is used for updating the service control variable in the data sharing object according to the update message when receiving the update message of the service control variable, and sending the updated service control variable to the second screen state through the data sharing protocol so as to update the service control information of the second screen state.
In a third aspect, an embodiment of the present invention provides a terminal, including:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the Android landscape screen data synchronization method according to any embodiment of the invention.
In a fourth aspect, an embodiment of the present invention provides a readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for synchronizing the horizontal and vertical Android screen data according to any embodiment of the present invention.
According to the Android horizontal and vertical screen data synchronization method, device, terminal and readable medium provided by the embodiment of the invention, when the first screen state is switched to the second screen state, the second screen state can acquire the business control variable in the data sharing object, namely the current value of the business control variable during switching, and the business control information is set according to the acquired business control variable; and when the business control variable in the data sharing object is updated according to the updating message, the updated business control variable can be sent to the second screen state through the data sharing protocol so as to update the business control information of the second screen state. The synchronization of the information of the current service control after Android horizontal and vertical screen switching is realized by setting the data sharing object, the data synchronization stability is improved, and the condition of data synchronization abnormity is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description will be given below of the drawings required for the embodiments or the technical solutions in the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart of a method for synchronizing horizontal and vertical screen data of Android according to a first embodiment of the present invention;
fig. 2 is a schematic structural diagram of an Android horizontal and vertical screen data synchronization device according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a terminal according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described through embodiments with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but 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.
Example one
Fig. 1 is a flowchart of an Android horizontal and vertical screen data synchronization method provided in an embodiment of the present invention, where this embodiment is applicable to an Android horizontal and vertical screen data synchronization situation, and the method may be implemented by a terminal, and may be implemented specifically by software and/or hardware in the terminal. Referring to fig. 1, the Android horizontal and vertical screen data synchronization method comprises the following steps:
s110, receiving a switching instruction, and switching the service control in the first screen state into the service control in the second screen state according to the switching instruction.
When the Android terminal horizontal and vertical screens are switched, a plurality of service controls in the horizontal and vertical screens need to synchronize service control information, wherein the service controls can comprise progress bar controls, volume adjustment controls, brightness adjustment controls and the like, the corresponding service control information can be progress bar control information, volume adjustment control information, brightness adjustment control information and the like, and for example, the corresponding service control information can be playing progress information of the progress bar controls, volume size information of the volume adjustment controls, screen brightness information of the brightness adjustment controls and the like. In the embodiment of the invention, the synchronization method of the progress bar control information during horizontal and vertical screen switching is taken as an example for explanation, and the synchronization process of other business control information during horizontal and vertical screen switching can refer to the synchronization process of the progress bar control information.
The switching instruction can be generated by pressing a physical key of the Android terminal by a user, can also be generated by touching a virtual key on a user interface of the Android terminal by the user, and can also be generated by sensing the change of the placement direction of the Android terminal by direction sensors such as a gyroscope and the like built in the Android terminal. After receiving the switching instruction, the Android terminal may switch the screen state according to the instruction, or may also be understood as switching the service control in the first screen state to the service control in the second screen state, where the service control in the first screen state and the service control in the second screen state may be service controls that have been loaded and stored in a terminal memory. After the service control in the first/second screen state is loaded, the update message can be processed to perform the update operation of the service control information.
Optionally, before receiving the handover instruction, the method further includes:
when the first screen state is opened for the first time, calling a control loading method in an Activity lifecycle function onCreate function to load a business control of the first screen state; and when the second screen state is opened for the first time, calling a control loading method in the lifecycle function onCreate function of the Activity to load the business control of the second screen state.
The Activity can be understood as display page information in an Android system, and the Android terminal needs to implement loading operation on a progress bar control and other business controls in an Activity lifecycle function onCreate function, wherein the onCreate function can be automatically called by the Android terminal when the Activity is started. For example, calling a control loading method in the lifecycle function onCreate function of Activity to load a progress bar control may specifically be:
ProgressBar progressBar=(ProgressBar)findViewByid(R.id.progress);
wherein findViewByid can be understood as that the progress bar service control is loaded according to id; progress can be understood as predefined progress bar id information; after the control is loaded according to the control loading method, progress Bar object information of a progress Bar type can be obtained; the progress bar type may also be a predefined class.
If the first screen state is opened for the first time, the business control in the first screen state is loaded at first, and when the first screen state is switched to the second screen state for the first time, the business control in the second screen state is loaded; and if the first screen state is opened, firstly loading the service control in the second screen state, and when the first screen state is switched from the second screen state to the first screen state, loading the service control in the first screen state. After the first/second screen state loads the service control for the first time, the service control is stored in the terminal memory, and when the first/second screen state is switched to again, the service control does not need to be loaded repeatedly.
By preloading the business control in the first/second screen state, the horizontal and vertical screen data synchronization is more convenient, all data information in the first/second screen state does not need to be copied in the synchronization process, the data synchronization stability is improved, and the abnormal data synchronization condition is avoided.
S120, acquiring a business control variable in the data sharing object, and setting business control information of a second screen state according to the business control variable, wherein the data sharing object is a static global variable object of the data sharing device class.
The data sharer class may be predefined, and after the data sharer class is defined, a data sharer class object, that is, a data sharing object, may be created. The business control variables can be defined in the data sharing objects, one data sharing object corresponds to one business control, and business control data corresponding to the business control can be stored in one data sharing object. The data sharing object is a static global variable object, and it can be understood that when any function acquires the data sharing object, the same data sharing object can be acquired. Therefore, the data sharing object acquired by the second screen when the first screen state is switched to the second screen state is the same as the data sharing object acquired by the first screen state when the subsequent second screen state is switched back to the first screen state.
Optionally, before receiving the handover instruction, the method further includes:
calling a sharer class definition method to define a data sharer class; calling a data sharing object definition method to define a data sharing object of the data sharing device class; and calling a service control variable definition method in the data sharing object to define a service control variable, initializing the service control variable, and updating the service control variable according to an update message when the update message of the service control variable is received.
The method for calling the sharer class definition to define the data sharer class specifically may be:
the data-sharer Class is defined by calling the Public Class DataShare { } method. The data sharing device class is a Public common type, so that other classes have the access right of the data sharing class. The class name of the data sharer class is datashore, and the class name of the data sharer class can be changed according to the requirements of research and development personnel, which is not limited herein.
The method for calling the data sharing object definition to define the data sharing object of the data sharing device class may specifically be:
the data sharing object is defined by calling the public static DataShare mDataShare () method. The data sharer object is of a Public common type, so that other objects have access rights of the data sharer object. The data sharing object is of a static type, so that the screen states after horizontal and vertical screen switching can acquire the same data sharing object. The data sharing object is an object of a data sharer class DataShare, and is named mDataShare, and the name of the data sharer object can be changed according to the requirements of research and development personnel, which is not limited herein.
The method for calling the service control variable definition method in the data sharing object to define the service control variable specifically may be:
and defining a business control variable by calling a private long progress Value method. The business control variable is a private type long integer variable. The business control variable name is a progress Value, that is, a progress bar control variable, and the business control variable name may also be changed according to the requirements of research and development personnel, and is not limited herein. After the business control variable is defined, the business control variable value can be initialized to 0. When the data sharing object receives the update message of the business control variable, the business control variable in the data sharing object can be updated according to the update message. The updated business control variable can be sent to the current screen state, and after the horizontal and vertical screen switching is carried out on the current screen state, the switched screen state can also obtain the latest business control variable from the data sharing object.
By acquiring the service control variable in the data sharing object, the screen state before switching and the screen state after switching are synchronized with the service control information when a switching event occurs.
Optionally, before receiving the handover instruction, the method further includes:
calling a predefined data sharing object acquisition method to judge whether the data sharing object can be acquired or not; if so, calling a return method to return the acquired data sharing object; if not, calling a data sharing object instantiation method to construct the data sharing object, and calling a return method to return the constructed data sharing object.
Specifically, the definition of the data shared object acquisition method may be performed by calling a Public DataShare getDataShare () method. The type of the data sharing object obtaining method is Public common type, so that other types have the access right of the method. Wherein the data sharing object obtaining method may return getDataShare type data, and the method has no parameter to participate in.
If the data sharing object can be obtained by the data sharing object obtaining method, the data sharing object is proved to have been instantiated, and the obtained data sharing object can be directly returned, so that corresponding processing operation is carried out on the data sharing object; if the data sharing object is not obtained by the data sharing object obtaining method, that is, mDataShare ═ null, and it is proved that the data sharing object has not been instantiated, the instantiation method mDataShare ═ new DataShare () may be called to construct the data sharing object, and the constructed data sharing object is returned, so that the corresponding processing operation is performed on the data sharing object. Wherein, the return data sharing object can be realized by a return mDataShare statement.
By the predefined data sharing object obtaining method, whether the data sharing object is instantiated or not can be judged, so that the situation that the data sharing object is constructed again by reapplying the memory space is avoided, the memory space is saved, and the uniqueness of the data sharing object is ensured.
S130, when the update message of the business control variable is received, the business control variable in the data sharing object is updated according to the update message, and the updated business control variable is sent to the second screen state through the data sharing protocol so as to update the business control information of the second screen state.
After the first screen state is switched to a second screen state, the second screen state firstly sets service control information according to the acquired service control variable in the data sharing object; and when the business control variable in the subsequent data sharing object is changed, the updated business control variable can be received through the data sharing protocol to update the business control information.
Preferably, when the second screen state obtains the service control variable, the data sharing object receives the service control variable update message, and the data sharing object can update the service control variable first and then send the updated service control variable to the second screen state, so that the update times of the service control information of the second screen state are reduced, and the abnormal update condition of the service control information is avoided.
Optionally, before receiving the handover instruction, the method further includes:
invoking the protocol definition method in the data sharing object to define the data sharing protocol and rewriting the data sharing protocol into the second screen state.
The protocol definition method may specifically be:
Public interface IonProgressValue{
Public void onProgressValueChanged(long progressValue);
};
the data sharing protocol is named IonProgressValue, a protocol method onProgressValueChanged is defined in the protocol, a long type parameter information progressValue exists in the protocol method, and the information of the progressValue in the data sharing object mDataShare is notified through the parameter. If the second screen state is to implement the IonProgressValue protocol and receive the updated service control variable, the protocol method onProgressValueChanged therein needs to be rewritten. If the first screen state needs to realize an IonProgressValue protocol, and receives the updated service control variable, the protocol method onProgressValueChanged therein also needs to be rewritten.
By defining the data sharing protocol, the data sharing object can send the updated business control variable information to the second screen state, so that the second screen state updates the business control information according to the updated information. Similarly, when the second screen state is switched to the first screen state, the data sharing object can also send the updated service control variable information to the first screen state through the data sharing protocol.
Optionally, the obtaining of the business control variable in the data sharing object includes:
and acquiring the business control variable in the data sharing object by a predefined business control variable acquisition method.
The definition of the service control variable acquisition method can be specifically performed by calling Public long getprogresvalue (). The method for acquiring the business control variable is a public function, the return value of the function is long data, and the value information of the private variable progressive value can be returned by calling a return progressive value method in the implementation of the function.
Optionally, when the first screen state is a vertical screen, the second screen state is a horizontal screen; and when the first screen state is a horizontal screen, the second screen state is a vertical screen.
That is, the service control of the vertical screen may be switched to the service control of the horizontal screen according to the received switching instruction; acquiring a business control variable in a data sharing object, and setting business control information of a horizontal screen according to the business control variable; and when an update message of the business control variable is received, updating the business control variable in the data sharing object according to the update message, and sending the updated business control variable to the horizontal screen through a data sharing protocol so as to update the business control information of the horizontal screen. The service control of the horizontal screen can be switched into the service control of the vertical screen according to the received switching instruction; acquiring a business control variable in a data sharing object, and setting business control information of a vertical screen according to the business control variable; and when an update message of the business control variable is received, updating the business control variable in the data sharing object according to the update message, and sending the updated business control variable to the vertical screen through the data sharing protocol so as to update the business control information of the vertical screen.
The method for loading the service controls in the first screen state and the second screen state, the data sharing protocol duplication mode in the first screen state and the second screen state, and the method for acquiring the service variables in the data sharing object in the first screen state and the second screen state through the service control variable method can be regarded as methods or modes with the same idea, that is, the methods with the same idea can be used in the first screen state and the second screen state to achieve the operation with the same purpose.
In the Android horizontal and vertical screen data synchronization method provided by this embodiment, when the first screen state is switched to the second screen state, the second screen state may obtain a service control variable in the data sharing object, that is, a current value of the service control variable during switching, and set service control information according to the obtained service control variable; and when the business control variable in the data sharing object is updated according to the updating message, the updated business control variable can be sent to the second screen state through the data sharing protocol so as to update the business control information of the second screen state. The synchronization of the information of the current service control after Android horizontal and vertical screen switching is realized by setting the data sharing object, the data synchronization stability is improved, and the condition of data synchronization abnormity is avoided.
Example two
Fig. 2 is a schematic structural diagram of an Android horizontal and vertical screen data synchronization device according to a second embodiment of the present invention, which is applicable to an Android horizontal and vertical screen data synchronization situation.
Referring to fig. 2, the Android horizontal and vertical screen data synchronization device in this embodiment includes:
the service control switching module 210 is configured to receive a switching instruction, and switch a service control in a first screen state to a service control in a second screen state according to the switching instruction;
the service control information setting module 220 is configured to obtain a service control variable in a data sharing object, and set service control information of a second screen state according to the service control variable, where the data sharing object is a static global variable object of a data sharer class;
and the service control information updating module 230 is configured to, when an update message of the service control variable is received, update the service control variable in the data sharing object according to the update message, and send the updated service control variable to the second screen state through the data sharing protocol, so as to update the service control information of the second screen state.
Optionally, the Android horizontal and vertical screen data synchronization device further includes:
the service control loading module is used for calling a control loading method in an Activity lifecycle function onCreate function to load the service control in the first screen state when the first screen state is opened for the first time; and the method is also used for calling a control loading method in the lifecycle function onCreate function of the Activity to load the business control of the second screen state when the second screen state is opened for the first time.
Optionally, the Android horizontal and vertical screen data synchronization device further includes:
the sharer class definition module is used for calling a sharer class definition method to define a data sharer class;
the shared object definition module is used for calling a data shared object definition method to define a data shared object of the data sharer class;
and the business control variable definition module is used for calling a business control variable definition method in the data sharing object to define the business control variable, initializing the business control variable, and updating the business control variable according to the update message when the update message of the business control variable is received.
Optionally, the Android horizontal and vertical screen data synchronization device further includes:
the shared object acquisition module is used for calling a predefined data shared object acquisition method to judge whether the data shared object can be acquired or not; if so, calling a return method to return the acquired data sharing object; if not, calling a data sharing object instantiation method to construct the data sharing object, and calling a return method to return the constructed data sharing object.
Optionally, the Android horizontal and vertical screen data synchronization device further includes:
and the sharing protocol definition module is used for calling a protocol definition method in the data sharing object to define the data sharing protocol and rewriting the data sharing protocol into the second screen state.
Optionally, the service control information setting module 220 is specifically configured to:
and acquiring the business control variable in the data sharing object by a predefined business control variable acquisition method.
Optionally, when the first screen state is a vertical screen, the second screen state is a horizontal screen; and when the first screen state is a horizontal screen, the second screen state is a vertical screen.
The Android horizontal and vertical screen data synchronization device provided by the embodiment belongs to the same inventive concept as the Android horizontal and vertical screen data synchronization method provided by the embodiment one, and technical details not described in detail in the embodiment can be referred to as the embodiment one, and the embodiment one have the same beneficial effects.
EXAMPLE III
The embodiment provides a terminal which can be used for Android horizontal and vertical screen data synchronization. Fig. 3 is a schematic structural diagram of a terminal according to a third embodiment of the present invention. Referring to fig. 3, the terminal includes:
one or more processors 310;
a memory 320 for storing one or more programs;
when the one or more programs are executed by the one or more processors 310, the one or more processors 310 implement the Android landscape and portrait data synchronization method as set forth in embodiment one.
In FIG. 3, a processor 310 is illustrated as an example; the processor 310 and the memory 320 may be connected by a bus or other means, such as the bus connection shown in FIG. 3.
The memory 320 is a computer-readable storage medium, and can be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the Android horizontal and vertical screen data synchronization method in the embodiment of the present invention. The processor 310 executes various functional applications and data processing of the terminal by running software programs, instructions and modules stored in the memory 320, that is, the Android horizontal and vertical screen data synchronization method is implemented.
The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 320 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 320 may further include memory located remotely from the processor 310, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The terminal provided by the embodiment and the Android horizontal and vertical screen data synchronization method provided by the embodiment belong to the same inventive concept, and technical details which are not described in detail in the embodiment can be referred to in the embodiment i.
Example four
The present embodiment provides a readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for synchronizing the horizontal and vertical screen data of the Android system as set forth in the first embodiment.
The readable medium provided by the embodiment and the Android horizontal and vertical screen data synchronization method provided by the embodiment belong to the same inventive concept, and technical details which are not described in detail in the embodiment can be referred to as the embodiment i, and the embodiment i have the same beneficial effects.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. An Android horizontal and vertical screen data synchronization method is characterized by comprising the following steps:
calling a sharer class definition method to define a data sharer class;
calling a data sharing object definition method to define a data sharing object of the data sharing device class; receiving a switching instruction, and switching the service control in the first screen state into the service control in the second screen state according to the switching instruction;
acquiring a business control variable in a data sharing object, and setting business control information of a second screen state according to the business control variable, wherein the data sharing object is a static global variable object of a data sharer class;
and when an update message of the business control variable is received, updating the business control variable in the data sharing object according to the update message, and sending the updated business control variable to the second screen state through the data sharing protocol so as to update the business control information of the second screen state.
2. The method of claim 1, prior to said receiving a handover command, further comprising:
when the first screen state is opened for the first time, calling a control loading method in an Activity lifecycle function onCreate function to load a business control of the first screen state;
and when the second screen state is opened for the first time, calling a control loading method in the lifecycle function onCreate function of the Activity to load the business control of the second screen state.
3. The method of claim 1, prior to said receiving a handover command, further comprising:
and calling a service control variable definition method in the data sharing object to define a service control variable, initializing the service control variable, and updating the service control variable according to an update message of the service control variable when the update message is received.
4. The method of claim 1, prior to said receiving a handover command, further comprising:
calling a predefined data sharing object acquisition method to judge whether the data sharing object can be acquired or not;
if so, calling a return method to return the acquired data sharing object;
if not, calling a data sharing object instantiation method to construct the data sharing object, and calling a return method to return the constructed data sharing object.
5. The method of claim 1, prior to said receiving a handover command, further comprising:
and calling a protocol definition method in the data sharing object to define the data sharing protocol, and rewriting the data sharing protocol into the second screen state.
6. The method of claim 1, wherein obtaining business control variables in the data sharing object comprises:
and acquiring the business control variable in the data sharing object by a predefined business control variable acquisition method.
7. The method according to any one of claims 1 to 6, wherein when the first screen state is a portrait screen, the second screen state is a landscape screen; and when the first screen state is a horizontal screen, the second screen state is a vertical screen.
8. The utility model provides an Android is horizontal vertical screen data synchronizer which characterized in that includes:
the sharer class definition module is used for calling a sharer class definition method to define a data sharer class;
the shared object definition module is used for calling a data shared object definition method to define a data shared object of the data sharer class;
the service control switching module is used for receiving a switching instruction and switching the service control in the first screen state into the service control in the second screen state according to the switching instruction;
the service control information setting module is used for acquiring a service control variable in a data sharing object and setting service control information of a second screen state according to the service control variable, wherein the data sharing object is a static global variable object of a data sharer class;
and the service control information updating module is used for updating the service control variable in the data sharing object according to the update message when receiving the update message of the service control variable, and sending the updated service control variable to the second screen state through the data sharing protocol so as to update the service control information of the second screen state.
9. A terminal, characterized in that the terminal comprises:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the Android landscape screen data synchronization method according to any one of claims 1-7.
10. A readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the Android landscape screen data synchronization method according to any one of claims 1-7.
CN201810889891.9A 2018-08-07 2018-08-07 Android horizontal and vertical screen data synchronization method and device, terminal and readable medium Active CN109144638B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810889891.9A CN109144638B (en) 2018-08-07 2018-08-07 Android horizontal and vertical screen data synchronization method and device, terminal and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810889891.9A CN109144638B (en) 2018-08-07 2018-08-07 Android horizontal and vertical screen data synchronization method and device, terminal and readable medium

Publications (2)

Publication Number Publication Date
CN109144638A CN109144638A (en) 2019-01-04
CN109144638B true CN109144638B (en) 2021-11-09

Family

ID=64792174

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810889891.9A Active CN109144638B (en) 2018-08-07 2018-08-07 Android horizontal and vertical screen data synchronization method and device, terminal and readable medium

Country Status (1)

Country Link
CN (1) CN109144638B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109766246B (en) * 2019-02-02 2023-04-07 北京字节跳动网络技术有限公司 Method and apparatus for monitoring applications
CN113504862A (en) * 2021-09-11 2021-10-15 腾讯科技(深圳)有限公司 View data processing method and device, target device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015123891A1 (en) * 2014-02-24 2015-08-27 华为技术有限公司 Multi-page management method and device
CN106973330A (en) * 2017-03-20 2017-07-21 腾讯科技(深圳)有限公司 A kind of screen live broadcasting method, device and system
CN107247746A (en) * 2017-05-23 2017-10-13 努比亚技术有限公司 A kind of data sharing method and terminal

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070086433A1 (en) * 2005-10-19 2007-04-19 Cunetto Philip C Methods and apparatus for allocating shared communication resources to outdial communication services
US20100100889A1 (en) * 2008-10-16 2010-04-22 International Business Machines Corporation Accelerating mutual exclusion locking function and condition signaling while maintaining priority wait queues
US8868849B2 (en) * 2011-08-17 2014-10-21 Samsung Electronics Co., Ltd. Coupled lock allocation and lookup for shared data synchronization in symmetric multithreading environments

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015123891A1 (en) * 2014-02-24 2015-08-27 华为技术有限公司 Multi-page management method and device
CN106973330A (en) * 2017-03-20 2017-07-21 腾讯科技(深圳)有限公司 A kind of screen live broadcasting method, device and system
CN107247746A (en) * 2017-05-23 2017-10-13 努比亚技术有限公司 A kind of data sharing method and terminal

Also Published As

Publication number Publication date
CN109144638A (en) 2019-01-04

Similar Documents

Publication Publication Date Title
CN109213462B (en) Android horizontal and vertical screen data synchronization method and device, terminal and readable medium
CN106874328B (en) Data processing method and equipment
CN107992537B (en) Service attribute transmission method, device, computer equipment and storage medium
US20170168807A1 (en) Method and electronic device for updating application program
CN109144638B (en) Android horizontal and vertical screen data synchronization method and device, terminal and readable medium
WO2021258951A1 (en) Method and apparatus for generating mirror image file, and computer-readable storage medium
CN114448895B (en) Application access method, device, equipment and medium
CN111600794B (en) Server switching method, terminal, server and storage medium
CN109033393B (en) Sticker processing method, device, storage medium and electronic equipment
CN110581885A (en) Method, device and equipment for determining equipment synchronization and storage medium
CN109067562A (en) Dynamic configuration update method and system, server and medium based on intelligent pointer
CN109189498B (en) Android horizontal and vertical screen data synchronization method and device, terminal and readable medium
CN114581580A (en) Method and device for rendering image, storage medium and electronic equipment
CN112044061B (en) Game picture processing method and device, electronic equipment and storage medium
TWI536175B (en) Updating files between computing devices via a wireless connection
CN109165067B (en) Android horizontal and vertical screen data synchronization method and device, terminal and readable medium
CN110324722B (en) Method, device, equipment and storage medium for acquiring data in live broadcast room
EP4270299A1 (en) Operating system upgrade method, electronic device, and storage medium
CN110311935A (en) A kind of sharing method shares deployment system and client
CN114138908A (en) Data synchronization method, device, terminal and storage medium
CN113660988A (en) Data processing method, device, system, equipment and computer readable storage medium
CN109167826B (en) Method, device and system for putting WEB application on shelf
CN109684009B (en) Protocol-based countdown synchronization method, device, storage medium and equipment
CN109062620B (en) Android frame animation execution method, device, terminal and readable medium
CN105740040A (en) Virtual machine data loading method and system

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