How to change FAB icon in an Activity during runtime. I have this code ->
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fabMainActivity);
I know this is possible using fab.setBackgroundDrawable();
but i am a newbie to android, don't understand how to do this.
Any help will be highly appreciated.
Thanks
Or you use the Support Library:
If you are using the Support Library:
Assume that you will use the image ic_arrow_forward.png as your fab's background:
fab.setImageResource(R.mipmap.ic_arrow_forward);
What I am using as follows,
Changing FloatingActionButton source:
This can be replaced by following code from the support library instead: