title: Executing a statement after the service is complete
body: <p>I have a  service which does VCardparsing . I want to execute a method when this is complete . Since my method contains DB query i cant include it directly in the service.</p>
  
  <p>I found that i can check if a service is running from <a href="https://stackoverflow.com/questions/600207/android-check-if-a-service-is-running">here</a>. But this doesnot serve my purpose. How can I proceed .</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>private void createFavorites() {
  
  
          DBAdapter db = new DBAdapter(this);
          db.open();
          Cursor favoriteCursor = db.getAllNumbers();
  
  
          Uri contactUri = ContactsContract.Data.CONTENT_URI;
          String[] contactProjection = new String[] {
                  ContactsContract.Data._ID,
                  ContactsContract.Data.DATA1,// gets number
                  ContactsContract.Data.DATA2,// gets type
          };
  
          Cursor contactCursor = managedQuery(contactUri, contactProjection,
                  null, null, null);
  
          CursorJoiner joiner = new CursorJoiner(favoriteCursor,
                  new String[] { DBAdapter.KEY_NUMBER }, contactCursor,
                  new String[] { ContactsContract.Data.DATA1 });
  
          MatrixCursor cursor = new MatrixCursor(new String[] { "number"}, 10);
          for (CursorJoiner.Result joinerResult : joiner) {
              switch (joinerResult) {
              case BOTH: // handle case where a row with the same key is in
                  String id = contactCursor.getString(0);
                  // String secret_identity = sipCursor.getString(1);
                  cursor.addRow(new String[] { id });
                  break;
              }
          }
          db.close();
          Log.d(LOG_TAG, "final favorite contact " + cursor.getCount() + favoriteCursor.getCount() + contactCursor.getCount());
  
      }
  </code></pre>
  
  <p>what I am trying to do here is that, I already have a database which holds my favorite numbers . When I parse a vcf if that number is present in one of those vcfs I want to mark them as favorites.</p>