Comments (10)
You might need to provide more code and a stacktrace for the exception as well. Could you add this information to your issue?
But from what I see, you might want to not @SuppressWarnings("ConstantConditions")
as it's a valid warning.
from badger.
I just to need get the variable countBadge Updated because the value is onCreapteOptionsMenu
and I need it updated in Activity onCreate I think I need a observer or interface ...
from badger.
i fixed something and the main problem is that the variable countBadge is null(I created it in onCreate) , because onCreate comes before the onCreateOptionsMenu...
from badger.
in your Example you get the badgeCount updated in the onOptionsitemSelected.. that nice but I want it as a variable to update it in onCreate activity
from badger.
Why do you need to set the value in onCreate
exactly? Would it be an option to do that work in onCreateOptionsMenu
or onStart
?
Due to the order of onCreate
-> onCreateOptionsMenu
-> onOptionsItemSelected
the badge is not setup when onCreate
is running.
Please post your code to help me help you.
from badger.
You right , and onCreate onOcreateOptions is called once... I'm updating the value after the activity's inflate and every time I click a Button ..
let me post some code so you can understand me
from badger.
You get the badge value updated when you click onOptionsItemSelected...
how can I get the badge value updated in the lifecycle every time I click a random button in an activity... ?
from badger.
Just add the change to the View.OnClickListener
you set for the button. By the time the user has access to any button, the menu item should be available already.
from badger.
the Button is in the Toolbar sir, so theItem.setOnMenuClickListener {} ?
from badger.
Thanks for your help sir, It's working :)
Stay safe.
from badger.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from badger.