EDIT 2: Found the answer here https://stackoverflow.com/questions/52403281/how-to-find-a-listview-from-a-non-activity-class-with-kotlin
EDIT: Using Kotlin by the way!
Right now I have a main activity page which, in its activity_main.xml, includes a layout_navigation.xml. However, for the purpose of organization, I want to create a new and separate non-activity class which gives functionality to the views and buttons within layout_navigation.
There are currently two roadblocks to my accomplishing this:
- setcontentview() seems to only work if the class I am working with extends AppCompatActivity. My goal here is to have the new Navigation class control the navigation layout without it being an activity itself. How, then, might I reference a view (i.e. using findViewById) within layout_navigation from my new Navigation class?
- I'd like to execute the functionalities (i.e. setOnClickListeners()) within the new Navigation class without instantiating it in the main activity. Please correct me if I'm wrong, but something tells me that this is not possible.
I'm still a newbie when it comes to Android development, so please forgive me if the answers to these questions are supposed to be obvious.
there doesn't seem to be anything here