How to simulate a button click using code?

How can I trigger a button click event using code in Android? I want to trigger the button click programmatically when some other event occurs.

Same Problem I am Facing

public void onDateSelectedButtonClick(View v){
    /*Something  Alarm Management 
    http://www.java2s.com/Code/Android/Core-Class/Alarmdemo.htm
    copied code from this site*/
}

Button code:

<Button
    android:onClick="onDateSelectedButtonClick"
    android:text="Set notification for this date" />

But I want to call that function OnLoadLayout without OnClickEvent

7 Answers
7

Leave a Comment