sam sam - 5 months ago 43x
Android Question

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
copied code from this site*/

Button code:

android:text="Set notification for this date" />

But I want to call that function OnLoadLayout without OnClickEvent


there is a better way.


this should answer all your problems. every View inherits this function, including Button, Spinner, etc.