findviewbyid in android code example
Example: findview by id in android
This is because findViewById() searches in the activity_main layout, while the button is located in the fragment's layout fragment_main.
This is because findViewById() searches in the activity_main layout, while the button is located in the fragment's layout fragment_main.