how can i know which event is called in which activity?

203 Views Asked by At

I want to create an activity monitor program which monitors activities and their events as specified.

Can you please tell me how can I know which event in a running activity is being executed? How can I collect data related to clicks or swipes in the same activity i.e. which button or menu is being clicked.

1

There are 1 best solutions below

0
On

You can get the running activity name by using-

this.getClass().getSimpleName()

I used above code many times to find running activity name in my App.

Try below code to find the pressed button information,

public void onClick(View view) {         
    Button b1 = (Button)view;
    String text = b1.getText().toString();
}