Reason why onStart finishes before onCreate
<p>On an application I'm working on the onCreate starts a service with startService() and subsequently after, that same activity calls bindService(to that same service) in its onStart. The problem is the Sevice isn't initialized until well after the onStart has completed which causes a fatal error from a nullpointer exception caused by a null service. I don't know how to get around this without using a half-assed solution and I have no idea how the onStart is finishing before the onCreate.</p>

<p>Suggestions? Any help is much appreciated.</p>

<pre><code>public class PNetworkService extends Service {
private final IBinder binder = new NtwkSvcBinder(this);


@Override
public void onCreate() {
    // Creates a HandlerThread to process the network events.
    HandlerThread handlerThread = new HandlerThread("SystemStartService",
            Process.THREAD_PRIORITY_BACKGROUND);
    // Starts the network thread.
    handlerThread.start();
    // Obtains looper so that that the NetworkServiceHandler is bound to that looper.
    serviceLooper = handlerThread.getLooper();
    // Create the Network Service Handler.
    nsh = new NetworkServiceHandler(serviceLooper, this);
    messenger = new Messenger(nsh);
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.i(TAG, "onStartCommand");
    return START_STICKY;
}

@Override
public IBinder onBind(Intent i) {
    Log.i(TAG, "onBind called");
    return binder;
}

public void setExtHandler(Handler extHandler) {
    Log.i(TAG, "setting exthandler");
        nsh.setExtHandler(extHandler);
}
}
</code></pre>
