title: bindService not binding to service
body: <p>So I have a bound service set up, but every time I call <code>bindService()</code> it never calls the <code>onBind()</code> method of my service and <code>onServiceConnected()</code> is never called. There is no error I can see, nothing is thrown.</p>
  
  <pre><code>private LoggingService mService;
  private boolean mBound = false;
  private boolean mLogging = false;
  
  private ServiceConnection mConnection = new ServiceConnection() {
  
      @Override
      public void onServiceConnected(ComponentName className, IBinder service){
          LocalBinder binder = (LocalBinder) service;
          mService = binder.getService();
          mBound = true;
      }
  
      @Override
      public void onServiceDisconnected(ComponentName arg0){
          mBound = false;
      }
  };
  ...
  @Override
  public void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
  
      if(!mBound){
          Intent intent = new Intent(getActivity(), LoggingService.class);
          getActivity().bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
      }
  }
  </code></pre>
  
  <p>I put breakpoints all over this. <code>bindService()</code> is definately called, but no matter how long I wait nothing in <code>onServiceConnected()</code> or anything in my service is called.</p>
  
  <p>So when I get here, it throws a <code>nullPointerException</code></p>
  
  <pre><code>logging.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
  
              if(mLogging){
                  Toast toast = Toast.makeText(getActivity(),
                          "Service stopping", Toast.LENGTH_LONG);
                  toast.show();
                  mService.stopLogging();
                  mLogging = false;
              } else {
                  Toast toast = Toast.makeText(getActivity(),
                          "Service Starting", Toast.LENGTH_LONG);
                  toast.show();
                  mService.startLogging("dude.jsn");
                  mLogging = true;
              }
          }
      });
  </code></pre>
  
  <p>Logging is a <code>Button</code>. No idea what I missed. This is being called from a fragment, but that shouldn't matter right? The context is still valid.</p>
  
  <pre><code>public class LoggingService extends Service {
      public static final int LOG_INTERVAL = 500;
      LocalBinder mBinder = new LocalBinder();
      LoggingThread thread;
  
      public class LocalBinder extends Binder {
          LoggingService getService() {
              return LoggingService.this;
          }
      }
  
  ...
  
      @Override
      public IBinder onBind(Intent intent) {
          return mBinder;
      }
  }
  </code></pre>
  
  <p>Any help pointing out what I missed would be awesome.</p>