首页 > android界面跳转的菜鸟问题

android界面跳转的菜鸟问题

    请问一下,一般的界面跳转是:

Intent intent=new Intent(A.this,B.class); startActivity(intent);

但是今天我偶然在网上看到另一种界面跳转的方法: Intent intent = new Intent(); intent.setClass(A.this, B.class);
startActivity(intent); 我想知道这两种界面跳转的方法有区别么,哪个更好一些,谢谢。


没区别
A和B是intent的两个属性,一个是在构造函数中赋值,一个是后来赋值。
从效率上讲没区别,更喜欢第一种,直白、明了,还少写一行代码。

【热门文章】
【热门文章】