TextView setTextColor() not working

The documentation is not very verbose about this, but you cannot use just the R.color integer when calling setTextColor. You need to call getResources().getColor(R.color.YOURCOLOR) to set a color properly.

Use the following to set color of your text programmatically:

textView.setTextColor(getResources().getColor(R.color.YOURCOLOR));

Starting with the support library 23 you have to use the following code, because getColor is deprecated:

textView.setTextColor(ContextCompat.getColor(context, R.color.YOURCOLOR));

So, there are many ways to achieve this task.

1.

int color = Integer.parseInt("bdbdbd", 16)+0xFF000000;
textview.setTextColor(color);

2.

textView.setTextColor(getResources().getColor(R.color.some_color));

3.

textView.setTextColor(0xffbdbdbd);

4.

textView.setTextColor(Color.parseColor("#bdbdbd"));

5.

textView.setTextColor(Color.argb(a_int, r_int, g_int, b_int));

1.standard color u prefer please go with below .

textview.setTextColor(Color.select_color)

2.here want to use custwom color add it in color.xml file

textview.setTextColor(getResources().getColor(R.color.textbody));

or

textView.setTextColor(Color.parseColor("#000000"));

or

subText.setTextColor(Color.rgb(255,192,0));