fix NullPointerException - #733
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. |
| 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.
Please don't use m prefix.
There was a problem hiding this comment.
Also I recommend not to hold on to the item in the activity scope.
|
|
||
| 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.
Don't use !! where it can be avoided.
In this case, checking whether menu is not null is valid.
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 |
keyboardsurfer
left a comment
There was a problem hiding this comment.
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 spotlessApplybefore submitting the PR🔮 Next steps
📸 Screenshots / GIFs