Android invoking View Click through code

Invoking click event on all the views (Buttons, Layout etc.,) through code can be done so easily.

Method 1

Call performClick() function on the view for which you want to perform click event

Button btnSend = findViewById(;
LinearLayout layoutContainer = findViewById(;

// perform click on button

// perform click on Linear Layout