如何使用Intent构造函数?

时间:2012-09-15 07:41:45

标签: android android-intent android-activity android-context

在android中,以下代码之间是否有任何区别?

  1. new Intent(this,MyOtherActivity.class);
  2. new Intent(Context.this,MyOtherActivity.class);
  3. new Intent(getApplicationContext(),MyOtherActivity.class);
  4. 请详细解释。示例代码也表示赞赏。

    提前致谢。

1 个答案:

答案 0 :(得分:1)

  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.