启动活动的最佳写法

public static void actionStart(Context context,String data1,String data2){
    Intent intent = new Intent(context,SecondActivity.class);
    intent.putExtra("param1",data1);
    intent.putExtra("param2",data2);
    context.startActivity(intent);

}

button.setOnClickListener(new OnClickListener(){

public void onClick(View v){

SecondActivity.actionStart(FirstActivity.this,"data1","data2");

}

}

posted @ 2017-04-16 21:46  Philtell  阅读(95)  评论(0编辑  收藏  举报