I have a list and i write a custom adapter for this. And I want to set some text color for this (e.g. Orange color code #F06D2F). I am presenting the code snippet for my g
You Can also use
text.setTextColor(0xFFF06D2F);
but not just
text.setTextColor(0xF06D2F);
textview.setTextColor(ContextCompat.getColor(context, R.color.your_color));
If you want to change your Text Color and take value from values/colors.xml If statement is holding text color for higher api because else version is depreciated in api23
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
textview_name.setTextColor(getColor(R.color.your_color_name));
}
else
{ textview_name.setTextColor(getResources().getColor(R.color.your_color_name));
}