Lately Android Studio has started showing me unnecessary NPE warnings for views in onCreate. The app compiles and runs properly but it's quite distracting, for instance, when the whole textView.setOnClickListener block is highlighted in yellow.
Annotations should prevent this but is there a way to do it globally from the settings without affecting the other NPE warnings?
Code sample here:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView label = (TextView) findViewById(R.id.label);
label.setOnClickListener(new View.OnClickListener() { //NPE warning for this
@Override
public void onClick(View v) {
// code here
}
});
}