Reputation: 2245
I use Kotlin in Android Studio 3.01, I get the following warning hint for the code if (isRegistered(mContext)==false )
in Code A.
How can I fix it? Thanks!
Warning Hint
Simplify boolean expression. This inspections reports boolean expressions that have parts which can be reduced to constants
Code A
public override fun onDestroy() {
if (isRegistered(mContext)==false ) {
if (isDebug()) {
openActivity(applicationContext, UIBuy::class.java)
} else {
openActivity(applicationContext, UIBuy::class.java)
}
}
super.onDestroy()
}
Upvotes: 1
Views: 1753
Reputation: 81879
You can simply change it to
if(!isRegistered(mContext))
The IDE will even suggest to make this change for you.
Upvotes: 4