I have a large project with 100s of fragments. They all pretty much follow the pattern I am going to describe and my question will follow.
public class MyFragment extends Fragment implements View.OnClickListener {
public void onDestroy(...) {
}
public void onCreateView(...) {
...
root.findViewById(R.id.some_button).setOnClickListener(this);
return root;
}
public void onClick(View v) { ... }
}
Do I need to free the listener from the fragment in onDestroy
? Is this a memory leak or going to cause any problems at all? Is it considered good practice to clean these up? And if possible an explanation of why?