Zero argument constructor Error in the Receiver Class

I am writing an app that will implement scheduled alarms which has problem in the Receiver Class.

What I want is, firstly, an alarm will be implemented in onCreate Part in the MainActivity.
Then at specific time, when the onRecive void receives the pendingIntent, the onReceive void will call another void in MainActivity. This is done by creating an interface and with empty void so that onReceive can call the method of the same name in MainActivity.
Finally the onReceive void will decide whether a notification shall be sent out depending on the result of the void called from MainActivity through interface.

I tried to referring to this answer and modify it to my script but it returns an error of

Process: com.example.sahelper, PID: 5930
    java.lang.RuntimeException: Unable to instantiate receiver com.example.sahelper.alarm.AlarmReceiver: java.lang.InstantiationException: java.lang.Class<com.example.sahelper.alarm.AlarmReceiver> has no zero argument constructor

Here is my MainActivity

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // AlarmController is used to schedule alarm
        AlarmController alarmController = 
            new AlarmController(MainActivity.this, MainActivity.this); 
        alarmController.new_test_alarm(); // schedule an alarm
    }

    // This method is supposed to be called by interface
    @Override
    public void check_duty()
    {
        // Do something here...
        // Do something here...
        // Do something here...
    }

Here is my AlarmController.java

    // Constructor
    public AlarmController(Activity activity, Context context)
    {
        this.myactivity = activity;
        this.mycontext = context;
    }

    public void new_test_alarm()
    {
        // Some codes here...
        // Some codes here...
        // Some codes here...

        Intent intent = new Intent(myactivity, AlarmReceiver.class);
        intent.setAction(SECOND_DEADLINE_ALARM_RECEIVE_ACTION);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(
                                    mycontext,
                                    Integer.parseInt(it.getKey()), // Here is the noti_id
                                    intent,
                                    FLAG_MUTABLE);

        AlarmManager alarmManager = (AlarmManager) myactivity.getSystemService   
                                (Context.ALARM_SERVICE);
        alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP,
                                    (System.currentTimeMillis() + 10 * 1000),
                                    pendingIntent);
}

Here is my interface

public interface Receiver_MainActivity_Interface
{
    public void check_duty();
}

And finally, here is my receiver class

public class AlarmReceiver extends BroadcastReceiver
{
    private Receiver_MainActivity_Interface mylistener;
    public AlarmReceiver(Receiver_MainActivity_Interface listener)
    {
        this.mylistener = listener;
    }

    @Override
    public void onReceive(Context context, Intent intent)
    {
        if (Objects.equals(intent.getAction(), SECOND_DEADLINE_ALARM_RECEIVE_ACTION))
        {
            mylistener.check_duty();
            
            // And some codes here continue...
            // And some codes here continue...
            // And some codes here continue...
        }
    }
}

I supsect the problem comes from the “Intent intent = new Intent(myactivity, AlarmReceiver.class);” as parameter shall be passed to AlarmReceiver class. But how should I pass the interface as a variable to it?

What shall I do to fix the problem? Any suggestion is appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật