Android 常用Intent封装



调用方式: Intents.getIntents().Intent(this, class,bundle);

封装类 Intents:

public class Intents {

private static Intents intents;

public static Intents getIntents(){
if(intents == null)
intents = new Intents();
return intents;
}
// context this, cs跳转对象 bundle 传递参数
public void Intent(Context context, Class cs, Bundle bundle) {
Intent i = new Intent(context, cs);
if (bundle != null)
i.putExtras(bundle);
context.startActivity(i);
}


}


这样的封装 很实用 避免了 每次跳转Activity 都去重复写一些 多余的代码。

  有意见可以 提出来哦

你可能感兴趣的:(android跳转封装)