param1, String param2){ Intent intent = new Intent(context, DetailActivity.class); intent.putExtra("PARAM_1", param1); intent.putExtra("PARAM_2",param2); context.startActivity(intent); } public static void startDetailActivity(Context context, String param1){ Intent intent = new Intent(context, DetailActivity.class); intent.putExtra("PARAM_1", param1); context.startActivity(intent); } public static void startDetailActivity(Context context, String param1, String param2){ Intent intent = new Intent(context, DetailActivity.class); if (param1 != null) intent.putExtra("PARAM_1", param1); if (param2 != null) intent.putExtra("PARAM_2",param2); context.startActivity(intent); } public static void startDetailActivity(Context context, String param1){ startDetailActivity(context, param1,null); } Refactoring