There is a line in my code, that marked as yellow:
getSupportActionBar().setDisplayShowHomeEnabled(true);
After installing appcompat-v7:22.1 it shows a hint:
"Method invocation may produce java.lang.nullpointerexception".
What should be used instead of getSupportActionBar()
?
getSupportActionBar().setDisplayShowHomeEnabled(true);
Should say
if (getSupportActionBar() != null)
{
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
getSupportActionBar() can return null so you the hint is telling you about this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With