ctivityCompat和ContextCompat有什么区别

ctivityCompat和ContextCompat有什么区别

I'm trying to use the Android camera, for API 23 or above, it requires asking for permission at runtime. According to the documentation, I can accomplish that using, ActivityCompat or ContextCompat. I don't understand what are the difference between the two and their trade-offs.Thank you for time. 解决方案 There's no trade-off really. Not sure why they wrote so - checkSelfPermission() is a method of ContextCompat and ActivityCompat is subclass (child) of ContextCompat so you can pass either one whenever object of ContextCompat class is required.Inheritance hierarchy (docs): 这篇关于ActivityCompat和ContextCompat有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-25 17:46