Intent intent = getPackageManager().getLaunchIntentForPackage(packageName); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); switch (v.getId()) { case R.id.btnOpen1: intent.putExtra("roomid","1"); startActivity(intent); break; case R.id.btnOpen2: intent.putExtra("roomid","2"); startActivity(intent); break; }