Java: Non-static nested classes and instance.super()

It’s called a “qualified superclass constructor invocation”. Citing from here: Explicit constructor invocation statements can be divided into two kinds: Alternate constructor invocations begin with the keyword this (possibly prefaced with explicit type arguments). They are used to invoke an alternate constructor of the same class. Superclass constructor invocations begin with either the keyword super … Read more

Call an activity method from a BroadcastReceiver class

Create the BroadcastReceiver dynamically: In your BroadcastReceiver class define class member: YourMainActivity yourMain = null; and method: setMainActivityHandler(YourMainActivity main){ yourMain = main; } from your MainActivity do: private YourBroadcastReceiverClassName yourBR = null; yourBR = new YourBroadcastReceiverClassName(); yourBR.setMainActivityHandler(this); IntentFilter callInterceptorIntentFilter = new IntentFilter(“android.intent.action.ANY_ACTION”); registerReceiver(yourBR, callInterceptorIntentFilter); finally, when yourBR.onReceive is fired you can call: yourMain.methodOfMainActivity();