Ejemplo n.º 1
0
  /**
   * Hook method called when the AcronymActivity becomes completely hidden to unbind the Activity
   * from the Services.
   */
  @Override
  public void onStop() {
    // Unbind the Async Service if it is connected.
    if (mServiceConnectionAsync.getInterface() != null) unbindService(mServiceConnectionAsync);

    // Unbind the Sync Service if it is connected.
    if (mServiceConnectionSync.getInterface() != null) unbindService(mServiceConnectionSync);

    super.onStop();
  }
Ejemplo n.º 2
0
  /**
   * Hook method called when the AcronymActivity becomes visible to bind the Activity to the
   * Services.
   */
  @Override
  public void onStart() {
    super.onStart();

    // Launch the Bound Services if they aren't already running
    // via a call to bindService(), which binds this activity to
    // the Acronym* Services if they aren't already bound.
    if (mServiceConnectionAsync.getInterface() == null)
      bindService(AcronymServiceAsync.makeIntent(this), mServiceConnectionAsync, BIND_AUTO_CREATE);

    if (mServiceConnectionSync.getInterface() == null)
      bindService(AcronymServiceSync.makeIntent(this), mServiceConnectionSync, BIND_AUTO_CREATE);
  }