title: How to instantiate android service with a constructor?
body: <p>I have a service with an following constructor:</p>
  
  <pre><code>public ShimmerService(Context context, Handler handler) {
      mHandler = handler;
  }
  </code></pre>
  
  <p>I want to instantiate this service class. I have following code but, I am not sure where to pass the paramater:</p>
  
  <pre><code>private ServiceConnection mConnection = new ServiceConnection() {
      public void onServiceConnected(ComponentName className, IBinder binder) {
          mShimmerService = ((ShimmerService.ShimmerConfigureBinder) binder)
                  .getService();
          Toast.makeText(ConfigureShimmer.this,
                  "Shimmer service has succesfully started.",
                  Toast.LENGTH_SHORT).show();
      }
  
      public void onServiceDisconnected(ComponentName className) {
          mShimmerService = null;
      }
  };
  </code></pre>
  
  <p>I have everything else setup including binding, on start and so on. But I get error in above code:</p>
  
  <pre><code>04-03 19:06:10.285: E/AndroidRuntime(16837): java.lang.RuntimeException: Unable to instantiate service com.milanix.androidecg.services.ShimmerService: java.lang.InstantiationException: can't instantiate class com.milanix.androidecg.services.ShimmerService; no empty constructor
  </code></pre>
  
  <p>How do I fix this problem? Where will i need to pass parameter? Following code works but, it rather uses service class as a class, rather than service:</p>
  
  <pre><code>mShimmerService = new ShimmerService(this, mHandler);
  </code></pre>