What is findViewById

Without ButterKnife

If you are not using ButterKnife, then you might want to take in consideration FindViewByMe.

FindViewByMe

Edit: I managed to push in the repository the support of the fragments and custom views and, as today, the developer published v1.3.5 of the plugin that solves the issues mentioned below. I Will update the GIFs accordingly.

This good plugin is still under development and doesn’t work well with fragments and custom views yet. In an Activity, it will do everything for you without having to manually define and assign the views that are inside the layout file. In fragments and custom views, you’ll need slightly more effort.

As mentioned before, it doesn’t work well with fragments yet, but we can make it work anyway. You’ll need to override onCreate, as the plugin only works by calling the generated method inside an onCreate method.

In a View, it works pretty much the same as in a Fragment. You can’t override onCreate, but you can cheat by creating a fake onCreate() method.

If you feel brave, you can help the developer of this plugin to improve it and fix the above-mentioned issues by forking the repository here.