Method and device for message processing by function class using handler

A message processing and functional technology, applied in the computer field, can solve the problems of losing the simplicity of the original Handler and complex implementation methods, and achieve the effects of improving development efficiency, reducing crash rate, and simple operation

Active Publication Date: 2020-11-10
BEIJING 58 INFORMATION TTECH CO LTD
View PDF1 Cites 0 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 message processing by function class using handler
  • Method and device for message processing by function class using handler
  • Method and device for message processing by function class using handler

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

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

[0037] Activity is one of the four most basic and most commonly used components in Android components (Activity, Service, Content Provider, Broadcast Receiver). Activity is an application component that provides a screen that users can use to interact in order to complete a task. All operations in Activity are closely related to the ...

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 embodiments of the present invention relate to computer technology, and in particular to a method and device for a function class to use Handler to process messages. Background technique [0002] The message handler (Handler) is a common application programming interface (API) used by Android developers for message transmission. It is mainly used for asynchronous message processing. After a message is sent, it first enters a message queue , The function that sends the 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 occurrence of out of memory (OOM) and applications (Application , APP) crash probability. [0003] In order to avoid memory leaks caused by the use of Handler, y...

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
Patent Type & Authority Patents(China)
IPC IPC(8): G06F9/54
CPCG06F9/546G06F2209/548
Inventor 王永川
Owner BEIJING 58 INFORMATION TTECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products