android: dynamically change FAB(Floating Action Button) icon from code
Changing FloatingActionButton source: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { floatingActionButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_full_sad, context.getTheme())); } else { floatingActionButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_full_sad)); } This can be replaced by following code from the support library instead: floatingActionButton.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_full_sad));