Android Knowledge Tree Talk (20190819)

1. When a network request is made in Androd, if a callback is made after the network request is completed, and the activity has been recycled, how to deal with it?

Inspect knowledge points:

  • acitvity view relationship and life cycle & memory model li>
  • How to prevent memory leaks (weak references, cancel requests, and callbacks)

Solve knowledge points:

  • activity view life cycle https://www.jianshu.com/p/0a4cb44ce9d1
  • acitvity view window relationship https://blog .csdn.net/freekiteyu/article/details/79408969
  • The role of Context https://www.cnblogs.com/tsingke/p/9127758.html
  • Weak reference experiment

   view holds the reference of activity (content) by default, activity can be finished, but not Was destroyed;

  • Kotlin implements callback cancellation through coroutines (binding activitylife cycle)

In experiment… p>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3568 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.