Vernacular callback (CallBack) method

For the original text, please see: http://topic.csdn.net/u/20100316/16/e17fe762-d1c3-47d0-a3e9-ee4005b730ef.html

 

The metaphor on the 4th floor is very appropriate, and I will share it with you here.

 

If you are hungry and want to eat, just ask your mother "Is it ready for dinner?" This is a normal function call.

But today, it took a long time for your mother to make dumplings. You run and run and you get bored. So you told your mother, I'll go out for a party first, and call my cell phone during dinner. After a while, your mother called you and said, "It's dinner, come back for dinner!"

Among them, you told your mother to call her phone Finding you is an action where you save the callback function handle to your mother. Your mother calls you, which is a callback process.

 

 

Summary: The callback method is generally an interface, and then the caller provides a specific implementation class as a parameter.

Callbacks are generally asynchronous calls, and the main thread will continue to run.

 

 

Guess you like

Origin blog.csdn.net/java2000_net/article/details/5435448