Android中打开新的Activity的三种方法

Posted 江清清

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android中打开新的Activity的三种方法相关的知识,希望对你有一定的参考价值。

         android中打开新的Activity的三种方法,平时在别人源代码的时候经常会看到一下三种方法,刚开始不懂,现在基本了解了:

 // 第一种方法:
Intent intent1 = new Intent(IntentActivity.this,
IntentSecond.class);
// 第二种方法:
Intent intent2 = new Intent();
intent2.setClass(IntentActivity.this, IntentSecond.class);
// 第三种方法:
Intent intent3 = new Intent();
intent3.setComponent(new ComponentName(IntentActivity.this,
IntentSecond.class));


startActivity(intent1);

        

以上是关于Android中打开新的Activity的三种方法的主要内容,如果未能解决你的问题,请参考以下文章