Can't instantiate receiver: class has no zero argument
<p>Although I know there are some answers out there already, I don't quite understand them as I am just a beginner in Android programming. I tried to instantiate my receiver using the following code:</p>

<pre><code>&lt;receiver
    android:name="com.example.android.exampleapp.MainActivity$NetworkChangeReceiver"
    android:enabled="true"
    android:label="NetworkChangeReceiver"&gt;
    &lt;intent-filter&gt;
        &lt;action android:name="android.net.wifi.STATE_CHANGE" /&gt;
    &lt;/intent-filter&gt;
&lt;/receiver&gt;
</code></pre>

<p>but it did not work. The logcat says:</p>

<pre><code>java.lang.RuntimeException:
Unable to instantiate receiver com.example.android.exampleapp.MainActivity$NetworkChangeReceiver:
    java.lang.InstantiationException:
        class com.example.android.exampleapp.MainActivity$NetworkChangeReceiver has no zero argument constructor
</code></pre>

<p>Part of my code in <strong>MainActivity.java</strong> is shown below:</p>

<pre><code>public class NetworkChangeReceiver extends BroadcastReceiver {
    /* All my code that reacts when WiFi state changes are here */
}
</code></pre>

<p>I know this question might sound easy, but I seriously do not know how to resolve this error. I had read <a href="https://stackoverflow.com/questions/29947038/java-lang-instantiationexception-class-has-no-zero-argument-constructor">this</a> (which I think is kinda invalid - I do not have a empty constructor) and a bunch of other online tutorials but I still can't get it. Any help would be appreciated :)</p>