[英]What's the difference for creating an Intent with context between getApplicationContext() or activity
We always create an Intent with context 我们总是根据上下文创建一个Intent
Intent intent = Intent(context, SomeClass.class)
I can use this(activity) or getActivity(fragment) as context, in some situations I can use getApplicationContext. 我可以使用this(activity)或getActivity(fragment)作为上下文,在某些情况下,我可以使用getApplicationContext。
My question is what't the difference for Intent under there two circumstances? 我的问题是,在两种情况下Intent有什么区别?
getApplicationContext()提供应用程序上下文,但是上下文提供当前活动上下文。希望它对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.