-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix NullPointerException #733
base: main
Are you sure you want to change the base?
Conversation
HomeActivity method onPrepareOptionsMenu menu.findItem(R.id.menu_designer_news_login) return null object use onCreateOptionsMenu find menu_designer_news_login
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Hi and thanks for your contribution. |
@@ -100,6 +100,7 @@ class HomeActivity : AppCompatActivity() { | |||
private lateinit var loading: ProgressBar | |||
private lateinit var feedAdapter: FeedAdapter | |||
private lateinit var filtersList: RecyclerView | |||
private lateinit var mDesignerNewsLogin: MenuItem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use m
prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I recommend not to hold on to the item in the activity scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your suggestion
@@ -450,6 +450,12 @@ class HomeActivity : AppCompatActivity() { | |||
return true | |||
} | |||
|
|||
override fun onCreateOptionsMenu(menu: Menu?): Boolean { | |||
menuInflater.inflate(R.menu.main,menu) | |||
mDesignerNewsLogin = menu!!.findItem(R.id.menu_designer_news_login) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use !!
where it can be avoided.
In this case, checking whether menu is not null is valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your suggestion
I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address my review comments in order to proceed on this PR.
HomeActivity method onPrepareOptionsMenu
menu.findItem(R.id.menu_designer_news_login) return null object
use onCreateOptionsMenu find menu_designer_news_login
📢 Type of change
📜 Description
💡 Motivation and Context
💚 How did you test it?
📝 Checklist
./gradlew spotlessApply
before submitting the PR🔮 Next steps
📸 Screenshots / GIFs