Unlock instant, AI-driven research and patent intelligence for your innovation.

Method and device for using Handler to carry out message processing by function class

A message processing and function technology, applied in the computer field, can solve the problems of complex implementation and loss of simplicity of native Handler, and achieve the effect of reducing the crash rate, improving development efficiency, and avoiding memory leaks.

Active Publication Date: 2017-12-26
BEIJING 58 INFORMATION TTECH CO LTD
View PDF1 Cites 7 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] However, the above-mentioned implementation method of using static inner class plus WeakReference is too complicated. It is necessary to declare a static inner class in every place where Handler is used. If multiple Handlers are needed for message transmission, multiple Handlers need to be declared, and then instantiated one by one. And it is judged empty before each use, losing the simplicity of the original Handler

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for using Handler to carry out message processing by function class
  • Method and device for using Handler to carry out message processing by function class
  • Method and device for using Handler to carry out message processing by function class

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0036] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

[0037] Activity is one of the most basic and most commonly used four components in Android components (Activity, service Service, content provider Content Provider, broadcast receiver BroadcastReceiver). Activity is an application component that provides a screen that the user can interact with in order to complete a certain task. All operations ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The embodiment of the invention provides a method and a device for using Handler to carry out message processing by a function class. The method for using the Handler to carry out the message processing by the function class comprises the following steps that: a function class receives a business processing request message; and the function class processes the business processing request message through a first Handler class and a second Handler class, wherein the second Handler class weakly cites the first Handler class, and the second Handler class is a native Handler subclass. By use of the embodiment of the invention, in a simple way, a reachable path from the native Handler to the function class is weak reachability, the problem of function class OOM (Out Of Memory) since the native Handler is directly used is effectively avoided, and the collapse rate and the OOM problem of APP can be lowered.

Description

technical field [0001] The embodiment of the present invention relates to computer technology, and in particular to a method and device for message processing by using a Handler as a functional class. Background technique [0002] The message handler (Handler) is a common application programming interface (Application Programming Interface, API) for Android developers to pass messages. It is mainly used for processing asynchronous messages. When a message is sent, it first enters a message queue , the function of sending a message returns immediately, and the other part takes out the messages one by one in the message queue, and then processes the messages. However, with the improper use or carelessness of developers, it is easy to cause memory leaks. In severe cases, several MB of memory space will be occupied, thereby increasing the probability of memory overflow (Out Of Memory, OOM) and application (Application) , APP) crash probability. [0003] In order to avoid memor...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/54
CPCG06F9/546G06F2209/548
Inventor 王永川
Owner BEIJING 58 INFORMATION TTECH CO LTD