alexa

Change color of icon in toolbar when click in android ?

Change color of icon in toolbar when click in android ?

You could create a global Menu variable and initialize it in the onCreateOptionsMenu() and then use it in your onClick().

 private Menu menu; 

In your onCreateOptionsMenu()

 this.menu = menu; 

In your button's onClick() method

 menu.getItem(0).setIcon(ContextCompat.getDrawable(this, R.drawable.red_heart));

279 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry