@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.tv_contact_name_call) { Intent intent = new Intent(MainActivity.this, CallActivity.class); String username = String.valueOf(true); intent.putExtra("CONTACT_NAME", username); intent.putExtra("CALL_STATE", "OUTGOING"); String ipAddress = String.valueOf(true); intent.putExtra("IP_ADDRESS", ipAddress); startActivity(intent); MessagingHelpers.sendCallRequest(username, ipAddress, ServiceHelpers.BROADCAST_PORT); } // when settings is clicked, the user gets visible on mainlayout if (id == R.id.action_settings) { layoutMain.setVisibility(View.VISIBLE); layoutUsername.setVisibility(View.GONE); AppGlobals.setVirgin(false); showUsername.setText("Username: "******"#4CAF50")); } else { // red = offline layoutMainTwo.setVisibility(View.GONE); showUsername.setTextColor(Color.parseColor("#F44336")); } // when refresh is clicked, it shows a list of peers in the same network } if (id == R.id.action_refresh) { peerList.setAdapter(null); if (!ServiceHelpers.DISCOVER) { ServiceHelpers.discover(MainActivity.this, peerList); } return true; } return super.onOptionsItemSelected(item); }