I'm trying to get toolbar's textColor
using this method:
private int getToolbarTextColor() {
int toolbarTextColor;
TypedArray typedArray = getTheme().obtainStyledAttributes(new int[]{R.attr.titleTextColor});
try {
toolbarTextColor = typedArray.getColor(0, Color.TRANSPARENT);
} catch (UnsupportedOperationException e) {
toolbarTextColor = Color.TRANSPARENT;
} finally {
typedArray.recycle();
}
return toolbarTextColor;
}
but it returns 0
. What is the problem in my code? What attribute should I use? Is there another better way to get it?