在android中,以下代码是否有区别?如何使用Intent构造函数?
- new Intent(this,MyOtherActivity.class);
- 新意图(Context.this,MyOtherActivity.class);
- 新意图(getApplicationContext(),MyOtherActivity.class);
请details.example代码解释也表示赞赏。
在此先感谢。
在android中,以下代码是否有区别?如何使用Intent构造函数?
请details.example代码解释也表示赞赏。
在此先感谢。
1> new Intent(this, MyOtherActivity.class); here this means the context of your current
activity
3> new Intent(getApplicationContext(), MyOtherActivity.class); here getApplicationContext() means the context of your application.
*您应该阅读* [文件和指南](http://developer.android.com/guide/components/intents-filters.html) – adatapost
为什么你要问? –