@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { // test notification Notifications not = new Notifications(); synchronized (not) { not.notification(getBaseContext()); } } }); Config.context = this; DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); phone(); Contacts c = new Contacts(); c.contacts(); SocketConnection sc = new SocketConnection(); sc.setAction("get_messages"); sc.execute(); SocketConnection sc2 = new SocketConnection(); sc2.setAction("get_new_messages"); sc2.execute(); }