public static void startactivity(final Context ctx, final @IdRes int id) { final int g = FastBinding.values().length; for (int i = 0; i < g; i++) { FastBinding bind = FastBinding.values()[i]; if (bind.getId() == id) { Intent intent = new Intent(ctx, bind.getClassName()); ctx.startActivity(intent); return; } } }
@Override public boolean onOptionsItemSelected(MenuItem item) { FastBinding.startactivity(this, item.getItemId()); return super.onOptionsItemSelected(item); }