コード例 #1
0
  private void disconnectFromRemoteDocument() {
    try {
      mPrintDocumentAdapter.setObserver(null);
    } catch (RemoteException re) {
      Log.w(LOG_TAG, "Error setting observer to the print adapter.");
      // Keep going - best effort...
    }

    mPrintDocumentAdapter.asBinder().unlinkToDeath(mDeathRecipient, 0);
  }
コード例 #2
0
  private void connectToRemoteDocument() {
    try {
      mPrintDocumentAdapter.asBinder().linkToDeath(mDeathRecipient, 0);
    } catch (RemoteException re) {
      Log.w(LOG_TAG, "The printing process is dead.");
      destroy();
      return;
    }

    try {
      mPrintDocumentAdapter.setObserver(new PrintDocumentAdapterObserver(this));
    } catch (RemoteException re) {
      Log.w(LOG_TAG, "Error setting observer to the print adapter.");
      destroy();
    }
  }