i have a broadcastreceiver.class
public class Myclass extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
}
}
i want to call function in broadcastreceiver which is in my activity.please tell me with some code how to made this here is my activity
public class MainActivity extends AppCompatActivity {
Context context = this;
private AudioManager myAudioManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
public void myfunction()
{
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName(getApplicationContext(),com.example.faisal.wifiprofile.MainActivity.class);
p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
handler.postDelayed(this, 100000);
}
}, 100000);
}
}
}
here is function name myfunction i want to call this function in broadcastreceiver please tell me good solution or edit my code thanks in advance