Passing a activity context into a static method, memory leak potential?

后端 未结 1 586
日久生厌
日久生厌 2020-12-16 17:39

I\'ve seen this particular technique for launching activities and it seems to me like a bad idea because of static contexts but I was hoping someone might have a legit reaso

相关标签:
1条回答
  • 2020-12-16 18:29

    Passing something into a static function isn't a potential memory leak. Storing a variable in a static variable is. This technique is perfectly safe. Its one I'd even recommend, as you can pass in variables to the function and store them in extras inside the class that is going to use those extras, reducing the number of places that need to know of their existence and how they're laid out

    0 讨论(0)
提交回复
热议问题