public void stopEndpoint(int id) { Endpoint endpoint = this.endpoint_manager.get(id); Client client = this.clients.get(id); if (client != null) { client.stopConnector(); endpoint.enabled = false; this.clients.remove(id); Toast.makeText( this, String.format( Locale.ENGLISH, this.getString(R.string.endpoint_stopped), endpoint.toConnectionString()), Toast.LENGTH_SHORT) .show(); } }