Note that there are some explanatory texts on larger screens.

plurals
  1. POBroadcastReceiver: can't instantiate class; no empty constructor
    text
    copied!<p>I have inner class as broadcast receiver:</p> <pre><code>public class ManualBacklightReceiver extends BroadcastReceiver { public static final String ACTION_MANUAL_BACKLIGHT = "com.android.systemui.statusbar.powerwidget.MANUAL_BACKLIGHT"; public ManualBacklightReceiver() { } @Override public void onReceive(Context context, Intent intent) { Log.d("ManualBacklightReceiver", intent.getAction()); } }; </code></pre> <p>AndroidManifest:</p> <pre><code>&lt;receiver android:name=".statusbar.powerwidget.PowerWidgetGrid$ManualBacklightReceiver"&gt; &lt;intent-filter&gt; &lt;action android:name="com.android.systemui.statusbar.powerwidget.MANUAL_BACKLIGHT"/&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; </code></pre> <p>And when I send the intent with this code: Intent intent = new Intent();</p> <pre><code>intent.setAction("com.android.systemui.statusbar.powerwidget.MANUAL_BACKLIGHT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.sendBroadcast(intent); </code></pre> <p>I get these exceptions:</p> <pre><code>java.lang.RuntimeException: Unable to instantiate receiver com.android.systemui.statusbar.powerwidget.PowerWidgetGrid$ManualBacklightReceiver: java.lang.InstantiationException: can't instantiate class com.android.systemui.statusbar.powerwidget.PowerWidgetGrid$ManualBacklightReceiver; no empty constructor Caused by: java.lang.InstantiationException: can't instantiate class com.android.systemui.statusbar.powerwidget.PowerWidgetGrid$ManualBacklightReceiver; no empty constructor </code></pre> <p>But I have an empty constructor! Why it doesn't work?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload