当我在 fragment 内时,this.context
之间有什么区别?和this.activity
例如:
val intent = Intent(this.activity!! , Activity::class.java)
val intent = Intent(this.context!! , Activity::class.java)
最佳答案
与上下文> 只要应用程序存在, Intent 就存在
with Activity > 只要 Activity 存在, Intent 就存在
现在你知道大多数情况下你需要什么..:-D
关于java - fragment 内的上下文和 Activity 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59474483/