Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android in the event delivery and handling mechanism     - Simple to use Linux GPG (Linux)

- Define and modify strings principle in Python (Programming)

- Android developers learning Adapter (data adapter) (Programming)

- Linux more efficient than select a model epoll (Linux)

- Basic data types JavaScript type system and the type of packaging (Programming)

- CentOS 6.6 shortcut command execution (Linux)

- Configuring LIDS build Linux kernel security intrusion detection system (Linux)

- Use Vagrant build cross-platform development environment for Python (Server)

- CentOS cross compiler core Raspberry Pi 2 (Linux)

- 10 important Linux ps command combat (Linux)

- SSH without password (Linux)

- Nginx load balancing configuration (TCP proxy) (Server)

- Swift defined type conversion and type aliases (typealias) (Programming)

- Linux Crontab Timing task command Detailed (Linux)

- In the case of using cgroups Ubuntu 14.04 and Docker (Linux)

- Linux system boot process detail (Linux)

- Linux installation beautify early experience (Linux)

- cp: omitting directory error solutions under Linux (Linux)

- MySQL5.6.17 compiler installation under CentOS (Database)

- Ubuntu 14.04 install PostgreSQL 9.2 (Database)

 
         
  Android in the event delivery and handling mechanism
     
  Add Date : 2016-05-02      
         
         
         
  All along, the transmission and processing mechanisms are deeply troubled by events in Android! Today, specifically to properly explore. Now the feeling is that as long as you understand the place, in fact, transmission and processing mechanisms events and did not imagine so difficult. In short, do yourself against yourself, to believe in yourself to master this knowledge. Well, here is my today's harvest, we hope you can have a little help.

First, the personification of the event to understand the android mechanism

In fact, android in the event delivery and treatment mechanism with our lives event handling is the same. There is a life example, it can illustrate the problem. Described as follows:

You are a company employee, you have a top director in charge of it and a top manager. For simplicity, this team you have these three individuals. So if one thing down on top of arrangements to be processed, the process is like?
Obviously your manager should be made to arrange this matter to your supervisor to deal with, your supervisor and then arrange it for you to deal with. Wait for you to run this thing, and you should report to your supervisor, and then from your supervisor to ask your manager
report. Obviously, your supervisors and managers also have to deal with this matter of privilege, if they feel things very complicated, you can not do, or take care of their relatively lower levels, may on their own to do this thing, and this time it is not again
Passed to the next level to deal with. The event handling procedure that is not too easy to understand!

In fact, android is the event processing flow with life event handling is the same. For example, you nested in a VewiGroupB ViewGroupA, and then nested in a MyView in ViewGroupB. Then a touch event passed over, what would happen? Analogy above process event employees will obviously occur the following procedure:

After passing over the touch event, ViewGroupA a look inside yourself there is a staff available, is ViewGroupB, not white do that, they will put this event to ViewGroupB, tell him that you gave me to deal with this event!

ViewGroupB a look at it, I am not afraid, I also have a staff which is MyView, which have to give me work, so he put this event to MyView, to deal with it. MyView a look, no way ah, I Shoudexia no employees, then how to do, I can only deal with their own (provided it has the ability to handle the event), so put the touch event to deal with. After processing is complete it? MyView is to give ViewGroupB report, I have to get things done, you come to review it to see if handled Zeyang. ViewGroupB a review, feel good, then the results would be presented to ViewGroupA. ViewGroupA then reviewed by the considered passed. In this process, several situations may occur:

(1) MyView that finished, my ability to do these things is not good, so he VeiwGroupB to report that I did not deal with, to ask you to deal with, you are my boss, ability stronger than me. So ViewGroupB will help to deal with. Of course, if there is no ability to handle ViewGroupB, it will only back to VeiwGroupA, let it digest this event.

(2) may also be treated perfectly MyView, a report to ViewGroupB, ViewGroupB do not have to say a happy ViewGroupA reviewed, I guarantee through, so this incident directly terminated.

The above is the image with the words adnroid the event delivery and handling mechanism to explain a bit. android with a few of the following methods will be perfectly encapsulates the above procedure:

In ViewGroup, there are the following three methods:
(1) dispatchTouchEvent the method used to distribute event, generally will not override this method
(2) onInterceptTouchEvent used to intercept events
(3) onTouchEvent to handle the event, this method should be all very common right

The View, the only two ways, namely:
(1) dispatchTouchEvent the method used to distribute event, generally will not override this method
(2) onTouchEvent to handle the event, this method should be all very common right

So we have to write an actual code, to verify these methods which correspond to the above process. This way there will be a more thorough understanding of this these methods.
     
         
         
         
  More:      
 
- Ubuntu clean up unnecessary disk space usage (Linux)
- Linux GCC 5.1.0 compiler installation (Linux)
- Shell Common Command Summary (Programming)
- installation and configuration of the PHP environment (Apache2) under Linux (Server)
- CentOS 6.5 system installation Oracle11.2.0.4 basic steps (Database)
- Linux commands with browsing and downloading files (Linux)
- Ubuntu install snmp packets Unlinked OID in IPATM-IPMC-MIB: marsMIB (Linux)
- Hazelcast integration with MongoDB (Database)
- Redis data types Introduction (Database)
- 64-bit Windows Server 2012 R2 install Oracle 10g Second Edition (Database)
- MongoDB version 3.2 WiredTiger storage engine performance tests (Database)
- Linux Security and Optimization (Linux)
- Some MySQL interview questions (Database)
- Linux virtual machines to solve end MySQL database can not remote access (Database)
- CentOS7 virtual machine starts appear Permission denied (Linux)
- OpenSSH version smooth upgrade method (Linux)
- Shorewall firewall settings under Ubuntu (Linux)
- HA-Federation-HDFS + Yarn cluster deployment (Server)
- Java and C / C ++ data conversion when network communication (Programming)
- Hutchison DG standby database CPU consumption reached bottleneck repair (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.