I need to write an application that would track clicks on the screen and display certain information. How to do it with a layout created programmatically, I know. I can not understand how to track down when the screen is created using the resource -> setContentView(R.layout.myLayout) ?

    1 answer 1

    In order to make the processing of the screen created through the resource, you need to create an object of the Layout class (or its subclass) and install a handler for it.

     RelativeLayout rl = (RelativeLayout) this.findViewById(R.id.myLayout); rl.setOnTouchListener(this);