Giter Club home page Giter Club logo

Comments (10)

tynn avatar tynn commented on June 9, 2024

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.

 avatar commented on June 9, 2024

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.

 avatar commented on June 9, 2024

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.

 avatar commented on June 9, 2024

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.

tynn avatar tynn commented on June 9, 2024

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.

 avatar commented on June 9, 2024

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.

 avatar commented on June 9, 2024

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.

tynn avatar tynn commented on June 9, 2024

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.

 avatar commented on June 9, 2024

the Button is in the Toolbar sir, so theItem.setOnMenuClickListener {} ?

from badger.

 avatar commented on June 9, 2024

Thanks for your help sir, It's working :)
Stay safe.

from badger.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.