加入收藏 | 设为首页 | 会员中心 | 我要投稿 开发网_郴州站长网 (http://www.0735zz.com/)- 云通信、区块链、物联设备、云计算、站长网!
当前位置: 首页 > 教程 > 正文

Android中打开新的Activity的三种技巧

发布时间:2021-12-18 14:44:34 所属栏目:教程 来源:互联网
导读:Android中打开新的Activity的三种方法,平时在别人源代码的时候经常会看到一下三种方法,刚开始不懂,现在基本了解了: // 第一种方法: Intent intent1 = new Intent(IntentActivity.this, IntentSecond.class); // 第二种方法: Intent intent2 = new Intent()
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);

(编辑:开发网_郴州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读