Code example for ActionBarActivity

Methods: onStop, unbindService

0
		bindService(serviceIntent, this, 0);
	} 
	 
	@Override 
	protected void onStop() { 
		if(service != null) unbindService(this);
		 
		dbHelper.close();
		 
		super.onStop(); 
	} 
 
	public void onServiceConnected(ComponentName name, IBinder b) {
		ServerConnectionService.ServiceBinder binder = (ServiceBinder) b;
		 
		service = binder.getService();
		 
		ServerConnection connection = service.getConnections().get( getIntent().getLongExtra(EXTRA_CONN_ID, -1) );
		 
		getSupportActionBar().setTitle( connection.getSettingsItem().getDisplayName() );
		getSupportActionBar().setSubtitle( connection.getSettingsItem().getDisplayAddress() );