Android 如何使用意图构造函数?

Android 如何使用意图构造函数?,android,android-intent,android-activity,android-context,Android,Android Intent,Android Activity,Android Context,在android中,以下代码之间有什么区别吗 新意图(此,MyOtherActivity.class) 新意图(Context.this、MyOtherActivity.class) 新意图(getApplicationContext(),MyOtherActivity.class) 请详细解释。示例代码也很感激 提前感谢。当我使用上下文或应用程序上下文时,您应该阅读“确定”。对于像服务这样的长时间运行的流程,请使用应用程序上下文 1> new Intent(this, MyOther

在android中,以下代码之间有什么区别吗

  • 新意图(此,MyOtherActivity.class)
  • 新意图(Context.this、MyOtherActivity.class)
  • 新意图(getApplicationContext(),MyOtherActivity.class) 请详细解释。示例代码也很感激


    提前感谢。

    当我使用上下文或应用程序上下文时,您应该阅读“确定”。对于像服务这样的长时间运行的流程,请使用应用程序上下文
      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.