I have implemented onTouchEvent(TouchEvent) on my activity. However, I would like to know what steps are required to register this as the event for the activities main Content view. I want to set the onTouchEvent for the view that covers the entire screen space of the activity. there is a setContentView() which takes a layout id. How do I register the activity as the ontouchEvent listener to the main content view. I am considering findByView(activityLayoutId) to get this view, but this does not seem quite like the right or best way. Thanks
I have implemented onTouchEvent(TouchEvent) on my activity. However, I would like to know what
Share
If you’re looking for a way to get your content view as a View after
Activity#setContentView(int), then you can set an id on the outer-most element of your layout:and reference it in your
onCreatemethod aftersetContentView: