Instatiating exception for a service class and a broadcast class
<p>Has been struggling on this for a week</p>

<p>I have two classes WiFiScanReceiver which extends BroadcastReceiver, WiFiNewClass which extends Service. WifiScanReceiver runs WifiNewclass as a service. And the WifiNewclass has the following code</p>

<pre><code>public class WiFiNewClass extends Service{
private static final String TAG = "WiFiScanReceiver";
private static final Object IMEI = null;
private static final Object VER = null;
  Wifiscan wifiDemo;
  TelephonyManager Tel;
  PhoneStateListener MyListener;

  public WiFiNewClass(Wifiscan wifiDemo) {
        super();
        this.wifiDemo = wifiDemo;
      }

 public void test(){
    wifiDemo = new Wifiscan();
////some other code

}
@Override
public IBinder onBind(Intent arg0) {
    // TODO Auto-generated method stub
    return null;
}
public void onCreate(){

    test();
    this.stopSelf();
}

}
</code></pre>

<p>when I run this code I get the following error. can any one please help me out. Thanks in advance</p>

<pre><code>06-08 18:50:07.014: ERROR/AndroidRuntime(3199): java.lang.RuntimeException: Unable to instantiate service org.wifi.WiFiNewClass: java.lang.InstantiationException: org.wifi.WiFiNewClass
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2764)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at android.app.ActivityThread.access$3200(ActivityThread.java:119)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at android.os.Looper.loop(Looper.java:123)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at android.app.ActivityThread.main(ActivityThread.java:4363)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at java.lang.reflect.Method.invokeNative(Native Method)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at java.lang.reflect.Method.invoke(Method.java:521)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at dalvik.system.NativeStart.main(Native Method)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199): Caused by: java.lang.InstantiationException: org.wifi.WiFiNewClass
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at java.lang.Class.newInstanceImpl(Native Method)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at java.lang.Class.newInstance(Class.java:1479)
06-08 18:50:07.014: ERROR/AndroidRuntime(3199):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2761)
</code></pre>
